Skip to contentSkip to conversation

mm-huge_memory-replace-can_split_folio-with-direct-refcount-calculation.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Dec 9, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/huge_memory: replace can_split_folio() with direct refcount calculation
has been removed from the -mm tree. Its filename was
mm-huge_memory-replace-can_split_folio-with-direct-refcount-calculation.patch

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

------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: mm/huge_memory: replace can_split_folio() with direct refcount calculation
Date: Wed, 26 Nov 2025 16:06:16 -0500

can_split_folio() is just a refcount comparison, making sure only the split caller holds an extra pin. Open code it with folio_expected_ref_count() != folio_ref_count() - 1. For the extra_pins used by folio_ref_freeze(), add folio_cache_ref_count() to calculate it. Also replace folio_expected_ref_count() with folio_cache_ref_count() used by folio_ref_unfreeze(), since they are returning the same values when a folio is frozen and folio_cache_ref_count() does not have unnecessary folio_mapcount() in its implementation.

---

 include/linux/huge_mm.h |    1 
 mm/huge_memory.c        |   52 ++++++++++++++------------------------
 mm/vmscan.c             |    3 +-
 3 files changed, 22 insertions(+), 34 deletions(-)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-huge_memory-replace-can_split_folio-with-direct-refcount-calculation +0 -1
@@ -369,7 +369,6 @@ enum split_type {
 	SPLIT_TYPE_NON_UNIFORM,
 };
 
-bool can_split_folio(struct folio *folio, int caller_pins, int *pextra_pins);
 int __split_huge_page_to_list_to_order(struct page *page, struct list_head *list,
 		unsigned int new_order);
 int folio_split_unmapped(struct folio *folio, unsigned int new_order);
mm/huge_memory.c renamed from mm/huge_memory.c~mm-huge_memory-replace-can_split_folio-with-direct-refcount-calculation +20 -32

129 lines not on this page · raw message

mm/vmscan.c renamed from mm/vmscan.c~mm-huge_memory-replace-can_split_folio-with-direct-refcount-calculation +2 -1
@@ -1284,7 +1284,8 @@ retry:
 					goto keep_locked;
 				if (folio_test_large(folio)) {
 					/* cannot split folio, skip it */
-					if (!can_split_folio(folio, 1, NULL))
+					if (folio_expected_ref_count(folio) !=
+					    folio_ref_count(folio) - 1)
 						goto activate_locked;
 					/*
 					 * Split partially mapped folios right away.

_

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