Re: [PATCH v3 1/4] mm: avoid unnecessary lru drain for wp_can_reuse_anon_folio()
From: Baoquan He
Date: Mon Jul 06 2026 - 06:05:25 EST
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.
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
Baoquan
>
> The concept hasn't changed since v2, but the code readability has
> improved quite a bit based on David's suggestions.
>
> Best Regards
> Barry