Re: [PATCH v2] mm: memcg: Use larger batches for proactive reclaim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 2, 2024 at 2:41 PM Johannes Weiner <hannes@xxxxxxxxxxx> 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@xxxxxxxxxx> 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@xxxxxxxxxxx>

-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);





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux