Re: [PATCH] mm/huge_memory: update file PUD counter before folio_put()

From: David Hildenbrand (Arm)

Date: Tue May 26 2026 - 08:57:22 EST


On 5/26/26 12:13, 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>
> ---

Acked-by: David Hildenbrand (arm) <david@xxxxxxxxxx>

--
Cheers,

David