Skip to contentSkip to conversation

mm-huge_memory-update-file-pmd-counter-before-folio_put.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jun 1 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/huge_memory: update file PMD counter before folio_put()
has been removed from the -mm tree. Its filename was
mm-huge_memory-update-file-pmd-counter-before-folio_put.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Yin Tirui <[email protected]>
Subject: mm/huge_memory: update file PMD counter before folio_put()
Date: Tue, 26 May 2026 18:13:37 +0800

__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 Baolin Wang <[email protected]>
Cc Barry Song <[email protected]>
Cc Chen Jun <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Nico Pache <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Yang Shi <[email protected]>
Cc Zi Yan <[email protected]>

---

 mm/huge_memory.c |    2 ++
 1 file changed, 2 insertions(+)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-huge_memory-update-file-pmd-counter-before-folio_put +2 -0
@@ -3133,7 +3133,9 @@ static void __split_huge_pmd_locked(stru
 			if (!folio_test_referenced(folio) && pmd_young(old_pmd))
 				folio_set_referenced(folio);
 			folio_remove_rmap_pmd(folio, page, vma);
+			add_mm_counter(mm, mm_counter_file(folio), -HPAGE_PMD_NR);
 			folio_put(folio);
+			return;
 		}
 		add_mm_counter(mm, mm_counter_file(folio), -HPAGE_PMD_NR);
 		return;

_

Patches currently in -mm which might be from [email protected] are