Re: [PATCH v3 1/4] mm: avoid unnecessary lru drain for wp_can_reuse_anon_folio()
From: Barry Song
Date: Mon Jul 06 2026 - 06:03:24 EST
On Mon, Jul 6, 2026 at 5:13 PM Baoquan He <baoquan.he@xxxxxxxxx> wrote:
>
> Hi Barry,
>
> On 07/06/26 at 04:18pm, Barry Song wrote:
> > On Thu, Jul 2, 2026 at 4:05 PM David Hildenbrand (Arm) <david@xxxxxxxxxx> wrote:
> > >
> > > On 7/2/26 01:59, Barry Song (Xiaomi) wrote:
> > > > There is a case where `folio_ref_count(folio) == 3` and
> > > > `!folio_test_swapcache(folio)`. In that case, both
> > > > `folio_ref_count(folio) > 3` and
> > > > `folio_ref_count(folio) > 1 + folio_test_swapcache(folio)` evaluate
> > > > false, causing an unnecessary local LRU drain.
> > > >
> > > > During an Ubuntu boot, I observed over 5,000 redundant local LRU
> > > > drains. For a kernel build with a minimal configuration, I observed
> > > > more than 20,000 redundant drains.
> > > >
> > > > Fix this by checking against: `1 + in_swapcache + in_lrucache`
> > > > instead of hardcoding `folio_ref_count(folio) > 3`.
> > > >
> > > > Suggested-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> > > > Reviewed-by: Kairui Song <kasong@xxxxxxxxxxx>
> > > > Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> > > > Reviewed-by: Baoquan He <baoquan.he@xxxxxxxxx>
> > > > Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
> > > > ---
> > > The other folks should probably re-review this patch that changed quite a bit :)
> > >
> > >
> > > Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> >
> > Thanks!
> >
> > Hi Baoquan, Shakeel, and Kairui,
> >
> > Would you like to re-review the patches so I can re-collect your
> > tags? If not, are you okay with me removing your tags when I
> > send v4?
>
> Is there change you need to do in a new version? If yes, please remove
> my tags, I will review v4. Oterwise, I will check this v3. Thanks.
no change for v4. Please feel free to re-review v3.
>
> AFAIK, usually, if patch is updated in a new version, any reviewing tags
> from the old version should be dropped unless the change is minor or
> trivial.
Thanks for the clarification. make sense to me.
Best Regards
Barry