Re: [PATCH] mm/huge_memory: update file PUD counter before folio_put()
From: Lance Yang
Date: Tue May 26 2026 - 08:58:24 EST
On Tue, May 26, 2026 at 06:13:55PM +0800, Yin Tirui wrote:
>__split_huge_pud_locked() updates the file/shmem RSS counter after
>dropping the PUD mapping's folio reference. If folio_put() drops the
>last reference, mm_counter_file() can later read freed folio state via
>folio_test_swapbacked().
>
>Move the counter update before folio_put().
>
>Fixes: dbe54153296d ("mm/huge_memory: add vmf_insert_folio_pud()")
>Cc: <stable@xxxxxxxxxxxxxxx>
>Signed-off-by: Yin Tirui <yintirui@xxxxxxxxxx>
>---
Thanks! Feel free to add:
Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>