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

From: Lance Yang

Date: Tue May 26 2026 - 09:02:14 EST



On Tue, May 26, 2026 at 06:13:37PM +0800, Yin Tirui wrote:
>__split_huge_pmd_locked() updates the file/shmem RSS counter after
>dropping the PMD 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: fadae2953072 ("thp: use mm_file_counter to determine update which rss counter")
>Cc: <stable@xxxxxxxxxxxxxxx>
>Signed-off-by: Yin Tirui <yintirui@xxxxxxxxxx>
>---

Thanks! Feel free to add:
Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>