lkml.org 
[lkml]   [2024]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] mm: memcg: Use larger batches for proactive reclaim
On Fri, Feb 2, 2024 at 2:41 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Fri, Feb 02, 2024 at 02:13:20PM -0800, Yosry Ahmed wrote:
> > On Fri, Feb 2, 2024 at 2:10 PM T.J. Mercier <tjmercier@google.com> wrote:
> > > @@ -6965,6 +6965,9 @@ static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf,
> > > while (nr_reclaimed < nr_to_reclaim) {
> > > unsigned long reclaimed;
> > >
> > > + /* Will converge on zero, but reclaim enforces a minimum */
> > > + unsigned long batch_size = (nr_to_reclaim - nr_reclaimed) / 4;
> > > +
> > > if (signal_pending(current))
> > > return -EINTR;
> > >
> > > @@ -6977,7 +6980,7 @@ static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf,
> > > lru_add_drain_all();
> > >
> > > reclaimed = try_to_free_mem_cgroup_pages(memcg,
> > > - min(nr_to_reclaim - nr_reclaimed, SWAP_CLUSTER_MAX),
> > > + batch_size,
> > > GFP_KERNEL, reclaim_options);
> >
> > I think the above two lines should now fit into one.
>
> Yeah might as well compact that again. The newline in the declarations
> is a bit unusual for this codebase as well, and puts the comment sort
> of away from the "reclaim" it refers to. This?
>
> /* Will converge on zero, but reclaim enforces a minimum */
> batch_size = (nr_to_reclaim - nr_reclaimed) / 4;
>
> reclaimed = try_to_free_mem_cgroup_pages(memcg, batch_size,
> GFP_KERNEL, reclaim_options);
>
> But agreed, it's all just nitpickety nickpicking. :)
>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>

-std=gnu11 to the rescue

+ /* Will converge on zero, but reclaim enforces a minimum */
+ unsigned long batch_size = (nr_to_reclaim - nr_reclaimed) / 4;
reclaimed = try_to_free_mem_cgroup_pages(memcg,
- min(nr_to_reclaim -
nr_reclaimed, SWAP_CLUSTER_MAX),
+ batch_size,
GFP_KERNEL, reclaim_options);

\
 
 \ /
  Last update: 2024-05-27 14:46    [W:0.042 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site