Re: [PATCH] mm/page_idle: call folio_test_lru() after folio_get()
From: SJ Park
Date: Wed Jul 22 2026 - 20:43:50 EST
On Wed, 22 Jul 2026 13:50:05 +0100 "Lorenzo Stoakes (ARM)" <ljs@xxxxxxxxxx> wrote:
> Nooooo :) this is not how you send patches.
>
> Also you should _reply_ to review comments, not just send another patch with no
> reply. Comms is king.
>
> Also - don't respin so quick. Wait a day.
>
> Then send a v2, NOT in reply to anything.
>
> Really best way is to use b4, docs at
> https://b4.docs.kernel.org/en/latest/contributor/prep.html and etc.
>
> But you can also do something like:
>
> git format-patch -v2 HEAD~1
> scripts/checkpatch.pl <patch filename>
> scripts/get_maintainer.pl <patch filename>
> git send-email --to="(andrew)" --cc="<list from get maintainers>" <patch filename>
>
>
> On Wed, Jul 22, 2026 at 07:20:20PM +0800, jiale yao wrote:
> > page_idle_get_folio() speculatively calls folio_test_lru() before
> > folio_try_get(). The folio can get freed and reallocated to a tail page
> > in the meantime. In that case, VM_BUG_ON_PGFLAGS() in
> > const_folio_flags() can be triggered. Remove the speculative call.
> >
> > This is a sibling-path bug: damon_get_folio() was copied from this
> > function with the same flawed pattern. Commit d6b8b02a27b3
> > ("mm/damon/ops-common: call folio_test_lru() after folio_get()") fixed
> > damon_get_folio(), but page_idle_get_folio() was left unfixed.
I was actually thinking I should also do this, but I was again failed at
managing my memory. Thank you for doing this, Jiale!
> > KCSAN
> > (strict mode) confirms the data race on the folio flags:
> >
> > BUG: KCSAN: data-race in ... / percpu_counter_add_batch
> > page_idle_get_folio+0x7a/0x2d0
> > page_idle_bitmap_read+0xc9/0x220
> >
> > Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
> > Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
>
> this should really be backported, so good to find the right commit to use as a Fixes: here.
>
> Also then add Cc: <stable@xxxxxxxxxxxxxxx> so it gets send for backporting.
>
> But _please_ wait a day before sending the v2 :)
>
> > ---
>
> Also in the v2 put a list of changes here (will not be included in commit msg)
> with links to previous versions on lore.
Assuming all the above nice suggestions from Lorenzo are accepted,
Reviewed-by: SJ Park <sj@xxxxxxxxxx>
Thanks,
SJ
[...]