All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code
@ 2026-12-01  9:58 Muchun Song
  2026-12-01  9:58 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

Hi,

This is based on the mm-new branch at commit 872ceec1e3ca.

HugeTLB vmemmap optimization has evolved over time, leaving obsolete
and duplicated logic spread across the implementation. This makes the
code harder to follow and obscures the contract shared by HugeTLB and
the generic vmemmap optimization helpers.

Simplify the code around that common contract and align the HVO
implementation with its current behavior.

The first five patches simplify the HugeTLB-specific implementation.
The final patch centralizes the support condition shared by HVO and the
generic compound-page helpers.

v2:
- Make the !CONFIG_HUGETLB_PAGE huge_page_order() stub const-correct
  (reported by Sashiko)
- Mention that the batch path reads the enable policy once at entry
  (suggested by Lance Yang)
- Document why the optimize path still requires a zero refcount
  (suggested by Lance Yang)
- Collect Reviewed-by tags from Lance Yang

v1: https://lore.kernel.org/all/20261124110530.3004071-1-songmuchun@bytedance.com/

Muchun Song (6):
  mm/hugetlb_vmemmap: remove the vmemmap savings boot message
  mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers
  mm/hugetlb_vmemmap: drop the redundant hstate argument
  mm/hugetlb_vmemmap: open-code free_vmemmap_page()
  mm/hugetlb_vmemmap: drop obsolete restore refcount warning
  mm/vmemmap-optimization: centralize the vmemmap optimization support
    check

 include/linux/hugetlb.h              |   4 +-
 include/linux/page-flags.h           |  10 +--
 include/linux/vmemmap-optimization.h |  14 +---
 mm/hugetlb.c                         |  14 ++--
 mm/hugetlb_vmemmap.c                 | 101 ++++++++++-----------------
 mm/hugetlb_vmemmap.h                 |  45 ++++--------
 6 files changed, 64 insertions(+), 124 deletions(-)


base-commit: 872ceec1e3caf227655a58f7407a9c8493dcf56f
-- 
2.54.0



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:26   ` + mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch added to mm-new branch Andrew Morton
  2026-12-01  9:58 ` [PATCH v2 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers Muchun Song
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

The boot message reports the potential vmemmap savings for each HugeTLB
page size. It is a static estimate and does not indicate whether HVO is
enabled or how much vmemmap memory is actually in use.

Users can query vm.hugetlb_optimize_vmemmap for the HVO enable policy
and inspect nr_memmap_pages and nr_memmap_boot_pages in /proc/vmstat
for the actual vmemmap usage.

Remove the boot message and hugetlb_vmemmap_optimizable_size(), which is
only used to calculate the reported estimate.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Make the !CONFIG_HUGETLB_PAGE huge_page_order() stub const-correct
  (reported by Sashiko)
- Collect Reviewed-by from Lance Yang
---
 include/linux/hugetlb.h |  4 ++--
 mm/hugetlb.c            |  2 --
 mm/hugetlb_vmemmap.h    | 27 ++++-----------------------
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index aea18895e145..14af4396de7e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -814,7 +814,7 @@ static inline unsigned long huge_page_mask(struct hstate *h)
 	return h->mask;
 }
 
-static inline unsigned int huge_page_order(struct hstate *h)
+static inline unsigned int huge_page_order(const struct hstate *h)
 {
 	return h->order;
 }
@@ -1233,7 +1233,7 @@ static inline unsigned long huge_page_mask(struct hstate *h)
 	return PAGE_MASK;
 }
 
-static inline unsigned int huge_page_order(struct hstate *h)
+static inline unsigned int huge_page_order(const struct hstate *h)
 {
 	return 0;
 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6a4af46ddded..688854ac732e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3759,8 +3759,6 @@ static void __init report_hugepages(void)
 		string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, sizeof(buf));
 		pr_info("registered %s page size, pre-allocated %ld pages\n",
 			buf, h->nr_huge_pages);
-		pr_info("%d KiB vmemmap can be freed for a %s page\n",
-			hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf);
 	}
 }
 
diff --git a/mm/hugetlb_vmemmap.h b/mm/hugetlb_vmemmap.h
index 8b28063d78cc..b7781baa2ce0 100644
--- a/mm/hugetlb_vmemmap.h
+++ b/mm/hugetlb_vmemmap.h
@@ -33,23 +33,6 @@ static inline void hugetlb_vmemmap_write_unlock(void)
 	up_write(&vmemmap_remap_rwsem);
 }
 
-static inline unsigned int hugetlb_vmemmap_size(const struct hstate *h)
-{
-	return pages_per_huge_page(h) * sizeof(struct page);
-}
-
-/*
- * Return how many vmemmap size associated with a HugeTLB page that can be
- * optimized and can be freed to the buddy allocator.
- */
-static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h)
-{
-	int size = hugetlb_vmemmap_size(h) - VMEMMAP_OPTIMIZATION_SIZE;
-
-	if (!is_power_of_2(sizeof(struct page)))
-		return 0;
-	return size > 0 ? size : 0;
-}
 #else
 static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
 {
@@ -80,11 +63,6 @@ static inline void hugetlb_vmemmap_write_unlock(void)
 {
 }
 
-static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h)
-{
-	return 0;
-}
-
 static inline void hugetlb_vmemmap_optimize_bootmem_page(unsigned long pfn, unsigned int order)
 {
 }
@@ -95,6 +73,9 @@ DEFINE_LOCK_GUARD_0(vmemmap_remap,
 
 static inline bool hugetlb_vmemmap_optimizable(const struct hstate *h)
 {
-	return hugetlb_vmemmap_optimizable_size(h) != 0;
+	if (!IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP))
+		return false;
+
+	return vmemmap_optimizable_order(huge_page_order(h));
 }
 #endif /* _LINUX_HUGETLB_VMEMMAP_H */
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
  2026-12-01  9:58 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:26   ` + mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch added to mm-new branch Andrew Morton
  2026-12-01  9:58 ` [PATCH v2 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument Muchun Song
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

vmemmap_should_optimize_folio() combines the global HVO policy,
per-hstate eligibility, and the already-optimized state. The latter two
do not need to gate the normal flow: generic folio and section helpers
check order eligibility, while optimization entry points only receive
freshly initialized folios. Thus, only the global enable policy must be
checked at every entry point.

Fold the global enable check into each caller. Retain the per-hstate
check in hugetlb_vmemmap_optimize_folios() only as an optimization, so
an ineligible hstate is rejected before iterating the entire folio
list. The batch path now reads the enable policy only once at entry
instead of once per folio in both passes.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Mention that the batch path reads the enable policy once at entry
  (suggested by Lance Yang)
- Collect Reviewed-by from Lance Yang
---
 mm/hugetlb_vmemmap.c | 38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 09b9fd83c198..71aa340cce55 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -488,21 +488,6 @@ long hugetlb_vmemmap_restore_folios(const struct hstate *h,
 	return ret;
 }
 
-/* Return true iff a HugeTLB whose vmemmap should and can be optimized. */
-static bool vmemmap_should_optimize_folio(const struct hstate *h, struct folio *folio)
-{
-	if (folio_test_hugetlb_vmemmap_optimized(folio))
-		return false;
-
-	if (!READ_ONCE(vmemmap_optimize_enabled))
-		return false;
-
-	if (!hugetlb_vmemmap_optimizable(h))
-		return false;
-
-	return true;
-}
-
 static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
 					    struct folio *folio,
 					    struct list_head *vmemmap_pages,
@@ -512,9 +497,6 @@ static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
 
 	VM_WARN_ON_ONCE_FOLIO(!folio_test_hugetlb(folio), folio);
 
-	if (!vmemmap_should_optimize_folio(h, folio))
-		return 0;
-
 	/*
 	 * Very Subtle
 	 * If VMEMMAP_DEFER_TLB_FLUSH is set, TLB flushing is not performed
@@ -548,32 +530,32 @@ void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
 {
 	LIST_HEAD(vmemmap_pages);
 
+	if (!READ_ONCE(vmemmap_optimize_enabled))
+		return;
+
 	guard(rwsem_read)(&vmemmap_remap_rwsem);
 	__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, 0);
 	free_vmemmap_page_list(&vmemmap_pages);
 }
 
-static int hugetlb_vmemmap_pteify_folio(const struct hstate *h, struct folio *folio,
-		unsigned long flags)
-{
-	if (!vmemmap_should_optimize_folio(h, folio))
-		return 0;
-
-	return vmemmap_pteify_folio(folio, flags);
-}
-
 void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list)
 {
 	struct folio *folio;
 	LIST_HEAD(vmemmap_pages);
 	unsigned long flags = VMEMMAP_DEFER_TLB_FLUSH;
 
+	if (!READ_ONCE(vmemmap_optimize_enabled))
+		return;
+
+	if (!hugetlb_vmemmap_optimizable(h))
+		return;
+
 	if (list_empty(folio_list))
 		return;
 
 	down_write(&vmemmap_remap_rwsem);
 	list_for_each_entry(folio, folio_list, lru) {
-		int ret = hugetlb_vmemmap_pteify_folio(h, folio, flags);
+		int ret = vmemmap_pteify_folio(folio, flags);
 
 		/*
 		 * Splitting the PMD requires allocating a page, thus let's fail
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
  2026-12-01  9:58 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
  2026-12-01  9:58 ` [PATCH v2 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:26   ` + mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch added to mm-new branch Andrew Morton
  2026-12-01  9:58 ` [PATCH v2 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page() Muchun Song
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

The single-folio optimize path and the single- and multi-folio restore
paths derive the vmemmap range, order, and NUMA node directly from each
folio. Their hstate argument is therefore no longer used.

Remove it from those paths and their internal helpers. Update the
callers accordingly.

Keep the hstate argument in the bulk optimize path so an ineligible
hstate can be rejected before iterating and pteifying the folio list.

No functional change intended.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Collect Reviewed-by from Lance Yang
---
 mm/hugetlb.c         | 12 ++++++------
 mm/hugetlb_vmemmap.c | 28 +++++++++++-----------------
 mm/hugetlb_vmemmap.h | 18 ++++++++----------
 3 files changed, 25 insertions(+), 33 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 688854ac732e..41e8cad12bff 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1521,7 +1521,7 @@ static void __update_and_free_hugetlb_folio(struct hstate *h,
 	 * is no longer identified as a hugetlb page.  hugetlb_vmemmap_restore_folio
 	 * can only be passed hugetlb pages and will BUG otherwise.
 	 */
-	if (clear_flag && hugetlb_vmemmap_restore_folio(h, folio)) {
+	if (clear_flag && hugetlb_vmemmap_restore_folio(folio)) {
 		spin_lock_irq(&hugetlb_lock);
 		/*
 		 * If we cannot allocate vmemmap pages, just refuse to free the
@@ -1673,7 +1673,7 @@ static void bulk_vmemmap_restore_error(struct hstate *h,
 			 * be freed without restoring vmemmap.
 			 */
 			if (folio_test_hugetlb(folio)) {
-				if (hugetlb_vmemmap_restore_folio(h, folio)) {
+				if (hugetlb_vmemmap_restore_folio(folio)) {
 					spin_lock_irq(&hugetlb_lock);
 					add_hugetlb_folio(h, folio, true);
 					spin_unlock_irq(&hugetlb_lock);
@@ -1703,7 +1703,7 @@ static void update_and_free_pages_bulk(struct hstate *h,
 	 * in an effort to make forward progress.
 	 */
 retry:
-	ret = hugetlb_vmemmap_restore_folios(h, folio_list, &non_hvo_folios);
+	ret = hugetlb_vmemmap_restore_folios(folio_list, &non_hvo_folios);
 	if (ret < 0) {
 		bulk_vmemmap_restore_error(h, folio_list, &non_hvo_folios);
 		goto retry;
@@ -1966,7 +1966,7 @@ static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h,
 
 	folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, NULL);
 	if (folio)
-		hugetlb_vmemmap_optimize_folio(h, folio);
+		hugetlb_vmemmap_optimize_folio(folio);
 	return folio;
 }
 
@@ -2135,7 +2135,7 @@ int dissolve_free_hugetlb_folio(struct folio *folio)
 		 * non-vmemmap optimized hugetlb folios.
 		 */
 		if (folio_test_hugetlb(folio)) {
-			rc = hugetlb_vmemmap_restore_folio(h, folio);
+			rc = hugetlb_vmemmap_restore_folio(folio);
 			if (rc) {
 				spin_lock_irq(&hugetlb_lock);
 				add_hugetlb_folio(h, folio, adjust_surplus);
@@ -4020,7 +4020,7 @@ static long demote_free_hugetlb_folios(struct hstate *src, struct hstate *dst,
 	LIST_HEAD(dst_list);
 	LIST_HEAD(ret_list);
 
-	rc = hugetlb_vmemmap_restore_folios(src, src_list, &ret_list);
+	rc = hugetlb_vmemmap_restore_folios(src_list, &ret_list);
 	list_splice_init(&ret_list, src_list);
 
 	/*
diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 71aa340cce55..4ed2db189f59 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -414,8 +414,7 @@ static int __init hugetlb_vmemmap_optimize_param(char *buf)
 }
 early_param("hugetlb_free_vmemmap", hugetlb_vmemmap_optimize_param);
 
-static int __hugetlb_vmemmap_restore_folio(const struct hstate *h,
-					   struct folio *folio, unsigned long flags)
+static int __hugetlb_vmemmap_restore_folio(struct folio *folio, unsigned long flags)
 {
 	int ret;
 
@@ -436,20 +435,18 @@ static int __hugetlb_vmemmap_restore_folio(const struct hstate *h,
  * hugetlb_vmemmap_restore_folio - restore previously optimized (by
  *				hugetlb_vmemmap_optimize_folio()) vmemmap pages which
  *				will be reallocated and remapped.
- * @h:		struct hstate.
  * @folio:     the folio whose vmemmap pages will be restored.
  *
  * Return: %0 if @folio's vmemmap pages have been reallocated and remapped,
  * negative error code otherwise.
  */
-int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
+int hugetlb_vmemmap_restore_folio(struct folio *folio)
 {
-	return __hugetlb_vmemmap_restore_folio(h, folio, 0);
+	return __hugetlb_vmemmap_restore_folio(folio, 0);
 }
 
 /**
  * hugetlb_vmemmap_restore_folios - restore vmemmap for every folio on the list.
- * @h:			hstate.
  * @folio_list:		list of folios.
  * @non_hvo_folios:	Output list of folios for which vmemmap exists.
  *
@@ -460,9 +457,8 @@ int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
  *		encountered. The folio that experienced the error and all
  *		non-processed folios will remain on folio_list.
  */
-long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios)
+long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+				    struct list_head *non_hvo_folios)
 {
 	struct folio *folio, *t_folio;
 	long restored = 0;
@@ -471,7 +467,7 @@ long hugetlb_vmemmap_restore_folios(const struct hstate *h,
 
 	list_for_each_entry_safe(folio, t_folio, folio_list, lru) {
 		if (folio_test_hugetlb_vmemmap_optimized(folio)) {
-			ret = __hugetlb_vmemmap_restore_folio(h, folio, flags);
+			ret = __hugetlb_vmemmap_restore_folio(folio, flags);
 			if (ret)
 				break;
 			restored++;
@@ -488,8 +484,7 @@ long hugetlb_vmemmap_restore_folios(const struct hstate *h,
 	return ret;
 }
 
-static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
-					    struct folio *folio,
+static int __hugetlb_vmemmap_optimize_folio(struct folio *folio,
 					    struct list_head *vmemmap_pages,
 					    unsigned long flags)
 {
@@ -518,7 +513,6 @@ static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
 
 /**
  * hugetlb_vmemmap_optimize_folio - optimize @folio's vmemmap pages.
- * @h:		struct hstate.
  * @folio:     the folio whose vmemmap pages will be optimized.
  *
  * This function only tries to optimize @folio's vmemmap pages and does not
@@ -526,7 +520,7 @@ static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
  * can use folio_test_hugetlb_vmemmap_optimized(@folio) to detect if @folio's
  * vmemmap pages have been optimized.
  */
-void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
+void hugetlb_vmemmap_optimize_folio(struct folio *folio)
 {
 	LIST_HEAD(vmemmap_pages);
 
@@ -534,7 +528,7 @@ void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
 		return;
 
 	guard(rwsem_read)(&vmemmap_remap_rwsem);
-	__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, 0);
+	__hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, 0);
 	free_vmemmap_page_list(&vmemmap_pages);
 }
 
@@ -573,7 +567,7 @@ void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_l
 	list_for_each_entry(folio, folio_list, lru) {
 		int ret;
 
-		ret = __hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, flags);
+		ret = __hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, flags);
 
 		/*
 		 * Pages to be freed may have been accumulated.  If we
@@ -587,7 +581,7 @@ void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_l
 			flush_tlb_all();
 			free_vmemmap_page_list(&vmemmap_pages);
 			INIT_LIST_HEAD(&vmemmap_pages);
-			__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, flags);
+			__hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, flags);
 		}
 	}
 
diff --git a/mm/hugetlb_vmemmap.h b/mm/hugetlb_vmemmap.h
index b7781baa2ce0..c75faf3e5510 100644
--- a/mm/hugetlb_vmemmap.h
+++ b/mm/hugetlb_vmemmap.h
@@ -15,11 +15,10 @@
 #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
 extern struct rw_semaphore vmemmap_remap_rwsem;
 
-int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio);
-long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios);
-void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio);
+int hugetlb_vmemmap_restore_folio(struct folio *folio);
+long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+				    struct list_head *non_hvo_folios);
+void hugetlb_vmemmap_optimize_folio(struct folio *folio);
 void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list);
 void hugetlb_vmemmap_optimize_bootmem_page(unsigned long pfn, unsigned int order);
 
@@ -34,20 +33,19 @@ static inline void hugetlb_vmemmap_write_unlock(void)
 }
 
 #else
-static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
+static inline int hugetlb_vmemmap_restore_folio(struct folio *folio)
 {
 	return 0;
 }
 
-static inline long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios)
+static inline long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+						  struct list_head *non_hvo_folios)
 {
 	list_splice_init(folio_list, non_hvo_folios);
 	return 0;
 }
 
-static inline void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
+static inline void hugetlb_vmemmap_optimize_folio(struct folio *folio)
 {
 }
 
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page()
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
                   ` (2 preceding siblings ...)
  2026-12-01  9:58 ` [PATCH v2 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:27   ` + mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch added to mm-new branch Andrew Morton
  2026-12-01  9:58 ` [PATCH v2 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning Muchun Song
  2026-12-01  9:58 ` [PATCH v2 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check Muchun Song
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

free_vmemmap_page() has a single caller. Open-code it in
free_vmemmap_page_list() and remove the helper.

No functional change.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Collect Reviewed-by from Lance Yang
---
 mm/hugetlb_vmemmap.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 4ed2db189f59..7ede6b6fb4eb 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -172,30 +172,19 @@ static int vmemmap_remap_range(unsigned long start, unsigned long end,
 	return 0;
 }
 
-/*
- * Free a vmemmap page. A vmemmap page can be allocated from the memblock
- * allocator or buddy allocator. If the PG_reserved flag is set, it means
- * that it allocated from the memblock allocator, just free it via the
- * free_reserved_page(). Otherwise, use __free_page().
- */
-static inline void free_vmemmap_page(struct page *page)
-{
-	if (PageReserved(page)) {
-		memmap_boot_pages_add(-1);
-		free_reserved_page(page);
-	} else {
-		memmap_pages_add(-1);
-		__free_page(page);
-	}
-}
-
-/* Free a list of the vmemmap pages */
 static void free_vmemmap_page_list(struct list_head *list)
 {
 	struct page *page, *next;
 
-	list_for_each_entry_safe(page, next, list, lru)
-		free_vmemmap_page(page);
+	list_for_each_entry_safe(page, next, list, lru) {
+		if (PageReserved(page)) {
+			memmap_boot_pages_add(-1);
+			free_reserved_page(page);
+		} else {
+			memmap_pages_add(-1);
+			__free_page(page);
+		}
+	}
 }
 
 static int alloc_vmemmap_page_list(struct list_head *head,
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
                   ` (3 preceding siblings ...)
  2026-12-01  9:58 ` [PATCH v2 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page() Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:27   ` + mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch added to mm-new branch Andrew Morton
  2026-12-01  9:58 ` [PATCH v2 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check Muchun Song
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

Commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative
PFN walkers") added this warning alongside RCU protection that
serialized page_ref_add_unless() against HVO remapping. The zero head
refcount was part of that protocol while the vmemmap was folded or
unfolded.

That RCU protection was later removed by commit 32c440d67e6c ("mm:
drop fake head checks") and commit 01b1d0ffb6f7 ("hugetlb: remove
VMEMMAP_SYNCHRONIZE_RCU"). Commit 0120a603afad
("mm/hugetlb_vmemmap: map the shared tail page writable") now handles
the original race by allowing a late cmpxchg to fail safely against
the zero refcount on the shared tail page.

The head folio refcount no longer participates in this protection.
Drop the stale warning from the restore path.

The matching warning in the optimize path remains necessary because
that path copies the head struct page. A zero refcount prevents
concurrent users from acquiring a reference and writing to it during
the copy. Document this requirement at the warning.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Document why the optimize path still requires a zero refcount in code
  and the commit message (suggested by Lance Yang)
- Collect Reviewed-by from Lance Yang
---
 mm/hugetlb_vmemmap.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 7ede6b6fb4eb..336b1405cd6a 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -348,6 +348,11 @@ static int vmemmap_optimize_folio(const struct folio *folio,
 
 	rwsem_assert_held(&vmemmap_remap_rwsem);
 
+	/*
+	 * The refcount must remain zero to prevent concurrent users from
+	 * acquiring a reference and writing to the head struct page while it
+	 * is copied during remapping.
+	 */
 	VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio), folio);
 
 	if (!vmemmap_optimizable_order(folio_order(folio)))
@@ -408,7 +413,6 @@ static int __hugetlb_vmemmap_restore_folio(struct folio *folio, unsigned long fl
 	int ret;
 
 	VM_WARN_ON_ONCE_FOLIO(!folio_test_hugetlb(folio), folio);
-	VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio), folio);
 
 	if (!folio_test_hugetlb_vmemmap_optimized(folio))
 		return 0;
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check
  2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
                   ` (4 preceding siblings ...)
  2026-12-01  9:58 ` [PATCH v2 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning Muchun Song
@ 2026-12-01  9:58 ` Muchun Song
  2026-12-01 21:27   ` + mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch added to mm-new branch Andrew Morton
  5 siblings, 1 reply; 13+ messages in thread
From: Muchun Song @ 2026-12-01  9:58 UTC (permalink / raw)
  To: Oscar Salvador, Mike Rapoport, David Hildenbrand, Andrew Morton
  Cc: Muchun Song, Lance Yang, Qi Zheng, linux-mm, Muchun Song

Whether vmemmap optimization is supported depends on both the configuration
and struct page having a power-of-two size. Open-coding this condition
in several places makes the support contract easy to duplicate.

Express this contract once in vmemmap_optimization_supported(). Make the
existing checks use it.

No functional change intended.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
---
v2:
- Collect Reviewed-by from Lance Yang
---
 include/linux/page-flags.h           | 10 ++++++----
 include/linux/vmemmap-optimization.h | 14 +++-----------
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b0ddc652e76c..6133966ba292 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -193,6 +193,11 @@ enum pageflags {
 #define PAGEFLAGS_MASK		((1UL << NR_PAGEFLAGS) - 1)
 
 #ifndef __GENERATING_BOUNDS_H
+static __always_inline bool vmemmap_optimization_supported(void)
+{
+	return IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION) &&
+	       is_power_of_2(sizeof(struct page));
+}
 
 /*
  * For tail pages, if the size of struct page is power-of-2 ->compound_info
@@ -210,10 +215,7 @@ static __always_inline bool compound_info_has_mask(void)
 	 * but it requires validating that struct pages are naturally aligned
 	 * for all orders up to the MAX_FOLIO_ORDER, which can be tricky.
 	 */
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	return is_power_of_2(sizeof(struct page));
+	return vmemmap_optimization_supported();
 }
 
 static __always_inline unsigned long _compound_head(const struct page *page)
diff --git a/include/linux/vmemmap-optimization.h b/include/linux/vmemmap-optimization.h
index 985a37dfcab7..0ae8a96a0874 100644
--- a/include/linux/vmemmap-optimization.h
+++ b/include/linux/vmemmap-optimization.h
@@ -21,9 +21,7 @@
  * HVO which is only active if the size of struct page is a power of 2.
  */
 #define MAX_FOLIO_VMEMMAP_ALIGN					\
-	(IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION) &&		\
-	 is_power_of_2(sizeof(struct page)) ?			\
-	 MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0)
+	(vmemmap_optimization_supported() ? MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0)
 
 /* The number of retained vmemmap pages with HVO enabled. */
 #define VMEMMAP_OPTIMIZATION_PAGES		1
@@ -33,10 +31,7 @@
 
 static inline bool vmemmap_optimizable_order(unsigned int order)
 {
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	if (!is_power_of_2(sizeof(struct page)))
+	if (!vmemmap_optimization_supported())
 		return false;
 
 	return order >= VMEMMAP_OPTIMIZATION_MIN_ORDER;
@@ -115,10 +110,7 @@ static inline bool vmemmap_optimizable_pfn(unsigned long pfn, unsigned int order
 {
 	const unsigned long nr_pages = 1UL << order;
 
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	if (!is_power_of_2(sizeof(struct page)))
+	if (!vmemmap_optimization_supported())
 		return false;
 
 	return (pfn & (nr_pages - 1)) >= VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES;
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* + mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
@ 2026-12-01 21:26   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:26 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/hugetlb_vmemmap: remove the vmemmap savings boot message
has been added to the -mm mm-new branch.  Its filename is
     mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/hugetlb_vmemmap: remove the vmemmap savings boot message
Date: Tue, 01 Dec 2026 17:58:35 +0800

Patch series "mm: Simplify HugeTLB vmemmap optimization code", v2.

HugeTLB vmemmap optimization has evolved over time, leaving obsolete and
duplicated logic spread across the implementation.  This makes the code
harder to follow and obscures the contract shared by HugeTLB and the
generic vmemmap optimization helpers.

Simplify the code around that common contract and align the HVO
implementation with its current behavior.

The first five patches simplify the HugeTLB-specific implementation.  The
final patch centralizes the support condition shared by HVO and the
generic compound-page helpers.


This patch (of 6):

The boot message reports the potential vmemmap savings for each HugeTLB
page size. It is a static estimate and does not indicate whether HVO is
enabled or how much vmemmap memory is actually in use.

Users can query vm.hugetlb_optimize_vmemmap for the HVO enable policy
and inspect nr_memmap_pages and nr_memmap_boot_pages in /proc/vmstat
for the actual vmemmap usage.

Remove the boot message and hugetlb_vmemmap_optimizable_size(), which is
only used to calculate the reported estimate.

Link: https://lore.kernel.org/20261201095840.3034368-1-songmuchun@bytedance.com
Link: https://patch.msgid.link/20261201095840.3034368-2-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 include/linux/hugetlb.h |    4 ++--
 mm/hugetlb.c            |    2 --
 mm/hugetlb_vmemmap.h    |   27 ++++-----------------------
 3 files changed, 6 insertions(+), 27 deletions(-)

--- a/include/linux/hugetlb.h~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message
+++ a/include/linux/hugetlb.h
@@ -814,7 +814,7 @@ static inline unsigned long huge_page_ma
 	return h->mask;
 }
 
-static inline unsigned int huge_page_order(struct hstate *h)
+static inline unsigned int huge_page_order(const struct hstate *h)
 {
 	return h->order;
 }
@@ -1233,7 +1233,7 @@ static inline unsigned long huge_page_ma
 	return PAGE_MASK;
 }
 
-static inline unsigned int huge_page_order(struct hstate *h)
+static inline unsigned int huge_page_order(const struct hstate *h)
 {
 	return 0;
 }
--- a/mm/hugetlb.c~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message
+++ a/mm/hugetlb.c
@@ -3759,8 +3759,6 @@ static void __init report_hugepages(void
 		string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, sizeof(buf));
 		pr_info("registered %s page size, pre-allocated %ld pages\n",
 			buf, h->nr_huge_pages);
-		pr_info("%d KiB vmemmap can be freed for a %s page\n",
-			hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf);
 	}
 }
 
--- a/mm/hugetlb_vmemmap.h~mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message
+++ a/mm/hugetlb_vmemmap.h
@@ -33,23 +33,6 @@ static inline void hugetlb_vmemmap_write
 	up_write(&vmemmap_remap_rwsem);
 }
 
-static inline unsigned int hugetlb_vmemmap_size(const struct hstate *h)
-{
-	return pages_per_huge_page(h) * sizeof(struct page);
-}
-
-/*
- * Return how many vmemmap size associated with a HugeTLB page that can be
- * optimized and can be freed to the buddy allocator.
- */
-static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h)
-{
-	int size = hugetlb_vmemmap_size(h) - VMEMMAP_OPTIMIZATION_SIZE;
-
-	if (!is_power_of_2(sizeof(struct page)))
-		return 0;
-	return size > 0 ? size : 0;
-}
 #else
 static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
 {
@@ -80,11 +63,6 @@ static inline void hugetlb_vmemmap_write
 {
 }
 
-static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h)
-{
-	return 0;
-}
-
 static inline void hugetlb_vmemmap_optimize_bootmem_page(unsigned long pfn, unsigned int order)
 {
 }
@@ -95,6 +73,9 @@ DEFINE_LOCK_GUARD_0(vmemmap_remap,
 
 static inline bool hugetlb_vmemmap_optimizable(const struct hstate *h)
 {
-	return hugetlb_vmemmap_optimizable_size(h) != 0;
+	if (!IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP))
+		return false;
+
+	return vmemmap_optimizable_order(huge_page_order(h));
 }
 #endif /* _LINUX_HUGETLB_VMEMMAP_H */
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

* + mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers Muchun Song
@ 2026-12-01 21:26   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:26 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers
has been added to the -mm mm-new branch.  Its filename is
     mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers
Date: Tue, 01 Dec 2026 17:58:36 +0800

vmemmap_should_optimize_folio() combines the global HVO policy,
per-hstate eligibility, and the already-optimized state. The latter two
do not need to gate the normal flow: generic folio and section helpers
check order eligibility, while optimization entry points only receive
freshly initialized folios. Thus, only the global enable policy must be
checked at every entry point.

Fold the global enable check into each caller. Retain the per-hstate
check in hugetlb_vmemmap_optimize_folios() only as an optimization, so
an ineligible hstate is rejected before iterating the entire folio
list. The batch path now reads the enable policy only once at entry
instead of once per folio in both passes.

Link: https://patch.msgid.link/20261201095840.3034368-3-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 mm/hugetlb_vmemmap.c |   38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

--- a/mm/hugetlb_vmemmap.c~mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers
+++ a/mm/hugetlb_vmemmap.c
@@ -488,21 +488,6 @@ long hugetlb_vmemmap_restore_folios(cons
 	return ret;
 }
 
-/* Return true iff a HugeTLB whose vmemmap should and can be optimized. */
-static bool vmemmap_should_optimize_folio(const struct hstate *h, struct folio *folio)
-{
-	if (folio_test_hugetlb_vmemmap_optimized(folio))
-		return false;
-
-	if (!READ_ONCE(vmemmap_optimize_enabled))
-		return false;
-
-	if (!hugetlb_vmemmap_optimizable(h))
-		return false;
-
-	return true;
-}
-
 static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
 					    struct folio *folio,
 					    struct list_head *vmemmap_pages,
@@ -512,9 +497,6 @@ static int __hugetlb_vmemmap_optimize_fo
 
 	VM_WARN_ON_ONCE_FOLIO(!folio_test_hugetlb(folio), folio);
 
-	if (!vmemmap_should_optimize_folio(h, folio))
-		return 0;
-
 	/*
 	 * Very Subtle
 	 * If VMEMMAP_DEFER_TLB_FLUSH is set, TLB flushing is not performed
@@ -548,32 +530,32 @@ void hugetlb_vmemmap_optimize_folio(cons
 {
 	LIST_HEAD(vmemmap_pages);
 
+	if (!READ_ONCE(vmemmap_optimize_enabled))
+		return;
+
 	guard(rwsem_read)(&vmemmap_remap_rwsem);
 	__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, 0);
 	free_vmemmap_page_list(&vmemmap_pages);
 }
 
-static int hugetlb_vmemmap_pteify_folio(const struct hstate *h, struct folio *folio,
-		unsigned long flags)
-{
-	if (!vmemmap_should_optimize_folio(h, folio))
-		return 0;
-
-	return vmemmap_pteify_folio(folio, flags);
-}
-
 void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list)
 {
 	struct folio *folio;
 	LIST_HEAD(vmemmap_pages);
 	unsigned long flags = VMEMMAP_DEFER_TLB_FLUSH;
 
+	if (!READ_ONCE(vmemmap_optimize_enabled))
+		return;
+
+	if (!hugetlb_vmemmap_optimizable(h))
+		return;
+
 	if (list_empty(folio_list))
 		return;
 
 	down_write(&vmemmap_remap_rwsem);
 	list_for_each_entry(folio, folio_list, lru) {
-		int ret = hugetlb_vmemmap_pteify_folio(h, folio, flags);
+		int ret = vmemmap_pteify_folio(folio, flags);
 
 		/*
 		 * Splitting the PMD requires allocating a page, thus let's fail
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

* + mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument Muchun Song
@ 2026-12-01 21:26   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:26 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/hugetlb_vmemmap: drop the redundant hstate argument
has been added to the -mm mm-new branch.  Its filename is
     mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/hugetlb_vmemmap: drop the redundant hstate argument
Date: Tue, 01 Dec 2026 17:58:37 +0800

The single-folio optimize path and the single- and multi-folio restore
paths derive the vmemmap range, order, and NUMA node directly from each
folio. Their hstate argument is therefore no longer used.

Remove it from those paths and their internal helpers. Update the
callers accordingly.

Keep the hstate argument in the bulk optimize path so an ineligible
hstate can be rejected before iterating and pteifying the folio list.

No functional change intended.

Link: https://patch.msgid.link/20261201095840.3034368-4-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 mm/hugetlb.c         |   12 ++++++------
 mm/hugetlb_vmemmap.c |   28 +++++++++++-----------------
 mm/hugetlb_vmemmap.h |   18 ++++++++----------
 3 files changed, 25 insertions(+), 33 deletions(-)

--- a/mm/hugetlb.c~mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument
+++ a/mm/hugetlb.c
@@ -1521,7 +1521,7 @@ static void __update_and_free_hugetlb_fo
 	 * is no longer identified as a hugetlb page.  hugetlb_vmemmap_restore_folio
 	 * can only be passed hugetlb pages and will BUG otherwise.
 	 */
-	if (clear_flag && hugetlb_vmemmap_restore_folio(h, folio)) {
+	if (clear_flag && hugetlb_vmemmap_restore_folio(folio)) {
 		spin_lock_irq(&hugetlb_lock);
 		/*
 		 * If we cannot allocate vmemmap pages, just refuse to free the
@@ -1673,7 +1673,7 @@ static void bulk_vmemmap_restore_error(s
 			 * be freed without restoring vmemmap.
 			 */
 			if (folio_test_hugetlb(folio)) {
-				if (hugetlb_vmemmap_restore_folio(h, folio)) {
+				if (hugetlb_vmemmap_restore_folio(folio)) {
 					spin_lock_irq(&hugetlb_lock);
 					add_hugetlb_folio(h, folio, true);
 					spin_unlock_irq(&hugetlb_lock);
@@ -1703,7 +1703,7 @@ static void update_and_free_pages_bulk(s
 	 * in an effort to make forward progress.
 	 */
 retry:
-	ret = hugetlb_vmemmap_restore_folios(h, folio_list, &non_hvo_folios);
+	ret = hugetlb_vmemmap_restore_folios(folio_list, &non_hvo_folios);
 	if (ret < 0) {
 		bulk_vmemmap_restore_error(h, folio_list, &non_hvo_folios);
 		goto retry;
@@ -1966,7 +1966,7 @@ static struct folio *alloc_fresh_hugetlb
 
 	folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, NULL);
 	if (folio)
-		hugetlb_vmemmap_optimize_folio(h, folio);
+		hugetlb_vmemmap_optimize_folio(folio);
 	return folio;
 }
 
@@ -2135,7 +2135,7 @@ retry:
 		 * non-vmemmap optimized hugetlb folios.
 		 */
 		if (folio_test_hugetlb(folio)) {
-			rc = hugetlb_vmemmap_restore_folio(h, folio);
+			rc = hugetlb_vmemmap_restore_folio(folio);
 			if (rc) {
 				spin_lock_irq(&hugetlb_lock);
 				add_hugetlb_folio(h, folio, adjust_surplus);
@@ -4020,7 +4020,7 @@ static long demote_free_hugetlb_folios(s
 	LIST_HEAD(dst_list);
 	LIST_HEAD(ret_list);
 
-	rc = hugetlb_vmemmap_restore_folios(src, src_list, &ret_list);
+	rc = hugetlb_vmemmap_restore_folios(src_list, &ret_list);
 	list_splice_init(&ret_list, src_list);
 
 	/*
--- a/mm/hugetlb_vmemmap.c~mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument
+++ a/mm/hugetlb_vmemmap.c
@@ -414,8 +414,7 @@ static int __init hugetlb_vmemmap_optimi
 }
 early_param("hugetlb_free_vmemmap", hugetlb_vmemmap_optimize_param);
 
-static int __hugetlb_vmemmap_restore_folio(const struct hstate *h,
-					   struct folio *folio, unsigned long flags)
+static int __hugetlb_vmemmap_restore_folio(struct folio *folio, unsigned long flags)
 {
 	int ret;
 
@@ -436,20 +435,18 @@ static int __hugetlb_vmemmap_restore_fol
  * hugetlb_vmemmap_restore_folio - restore previously optimized (by
  *				hugetlb_vmemmap_optimize_folio()) vmemmap pages which
  *				will be reallocated and remapped.
- * @h:		struct hstate.
  * @folio:     the folio whose vmemmap pages will be restored.
  *
  * Return: %0 if @folio's vmemmap pages have been reallocated and remapped,
  * negative error code otherwise.
  */
-int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
+int hugetlb_vmemmap_restore_folio(struct folio *folio)
 {
-	return __hugetlb_vmemmap_restore_folio(h, folio, 0);
+	return __hugetlb_vmemmap_restore_folio(folio, 0);
 }
 
 /**
  * hugetlb_vmemmap_restore_folios - restore vmemmap for every folio on the list.
- * @h:			hstate.
  * @folio_list:		list of folios.
  * @non_hvo_folios:	Output list of folios for which vmemmap exists.
  *
@@ -460,9 +457,8 @@ int hugetlb_vmemmap_restore_folio(const
  *		encountered. The folio that experienced the error and all
  *		non-processed folios will remain on folio_list.
  */
-long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios)
+long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+				    struct list_head *non_hvo_folios)
 {
 	struct folio *folio, *t_folio;
 	long restored = 0;
@@ -471,7 +467,7 @@ long hugetlb_vmemmap_restore_folios(cons
 
 	list_for_each_entry_safe(folio, t_folio, folio_list, lru) {
 		if (folio_test_hugetlb_vmemmap_optimized(folio)) {
-			ret = __hugetlb_vmemmap_restore_folio(h, folio, flags);
+			ret = __hugetlb_vmemmap_restore_folio(folio, flags);
 			if (ret)
 				break;
 			restored++;
@@ -488,8 +484,7 @@ long hugetlb_vmemmap_restore_folios(cons
 	return ret;
 }
 
-static int __hugetlb_vmemmap_optimize_folio(const struct hstate *h,
-					    struct folio *folio,
+static int __hugetlb_vmemmap_optimize_folio(struct folio *folio,
 					    struct list_head *vmemmap_pages,
 					    unsigned long flags)
 {
@@ -518,7 +513,6 @@ static int __hugetlb_vmemmap_optimize_fo
 
 /**
  * hugetlb_vmemmap_optimize_folio - optimize @folio's vmemmap pages.
- * @h:		struct hstate.
  * @folio:     the folio whose vmemmap pages will be optimized.
  *
  * This function only tries to optimize @folio's vmemmap pages and does not
@@ -526,7 +520,7 @@ static int __hugetlb_vmemmap_optimize_fo
  * can use folio_test_hugetlb_vmemmap_optimized(@folio) to detect if @folio's
  * vmemmap pages have been optimized.
  */
-void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
+void hugetlb_vmemmap_optimize_folio(struct folio *folio)
 {
 	LIST_HEAD(vmemmap_pages);
 
@@ -534,7 +528,7 @@ void hugetlb_vmemmap_optimize_folio(cons
 		return;
 
 	guard(rwsem_read)(&vmemmap_remap_rwsem);
-	__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, 0);
+	__hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, 0);
 	free_vmemmap_page_list(&vmemmap_pages);
 }
 
@@ -573,7 +567,7 @@ void hugetlb_vmemmap_optimize_folios(str
 	list_for_each_entry(folio, folio_list, lru) {
 		int ret;
 
-		ret = __hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, flags);
+		ret = __hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, flags);
 
 		/*
 		 * Pages to be freed may have been accumulated.  If we
@@ -587,7 +581,7 @@ void hugetlb_vmemmap_optimize_folios(str
 			flush_tlb_all();
 			free_vmemmap_page_list(&vmemmap_pages);
 			INIT_LIST_HEAD(&vmemmap_pages);
-			__hugetlb_vmemmap_optimize_folio(h, folio, &vmemmap_pages, flags);
+			__hugetlb_vmemmap_optimize_folio(folio, &vmemmap_pages, flags);
 		}
 	}
 
--- a/mm/hugetlb_vmemmap.h~mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument
+++ a/mm/hugetlb_vmemmap.h
@@ -15,11 +15,10 @@
 #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
 extern struct rw_semaphore vmemmap_remap_rwsem;
 
-int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio);
-long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios);
-void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio);
+int hugetlb_vmemmap_restore_folio(struct folio *folio);
+long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+				    struct list_head *non_hvo_folios);
+void hugetlb_vmemmap_optimize_folio(struct folio *folio);
 void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list);
 void hugetlb_vmemmap_optimize_bootmem_page(unsigned long pfn, unsigned int order);
 
@@ -34,20 +33,19 @@ static inline void hugetlb_vmemmap_write
 }
 
 #else
-static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
+static inline int hugetlb_vmemmap_restore_folio(struct folio *folio)
 {
 	return 0;
 }
 
-static inline long hugetlb_vmemmap_restore_folios(const struct hstate *h,
-					struct list_head *folio_list,
-					struct list_head *non_hvo_folios)
+static inline long hugetlb_vmemmap_restore_folios(struct list_head *folio_list,
+						  struct list_head *non_hvo_folios)
 {
 	list_splice_init(folio_list, non_hvo_folios);
 	return 0;
 }
 
-static inline void hugetlb_vmemmap_optimize_folio(const struct hstate *h, struct folio *folio)
+static inline void hugetlb_vmemmap_optimize_folio(struct folio *folio)
 {
 }
 
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

* + mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page() Muchun Song
@ 2026-12-01 21:27   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:27 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/hugetlb_vmemmap: open-code free_vmemmap_page()
has been added to the -mm mm-new branch.  Its filename is
     mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/hugetlb_vmemmap: open-code free_vmemmap_page()
Date: Tue, 01 Dec 2026 17:58:38 +0800

free_vmemmap_page() has a single caller. Open-code it in
free_vmemmap_page_list() and remove the helper.

No functional change.

Link: https://patch.msgid.link/20261201095840.3034368-5-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 mm/hugetlb_vmemmap.c |   29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

--- a/mm/hugetlb_vmemmap.c~mm-hugetlb_vmemmap-open-code-free_vmemmap_page
+++ a/mm/hugetlb_vmemmap.c
@@ -172,30 +172,19 @@ static int vmemmap_remap_range(unsigned
 	return 0;
 }
 
-/*
- * Free a vmemmap page. A vmemmap page can be allocated from the memblock
- * allocator or buddy allocator. If the PG_reserved flag is set, it means
- * that it allocated from the memblock allocator, just free it via the
- * free_reserved_page(). Otherwise, use __free_page().
- */
-static inline void free_vmemmap_page(struct page *page)
-{
-	if (PageReserved(page)) {
-		memmap_boot_pages_add(-1);
-		free_reserved_page(page);
-	} else {
-		memmap_pages_add(-1);
-		__free_page(page);
-	}
-}
-
-/* Free a list of the vmemmap pages */
 static void free_vmemmap_page_list(struct list_head *list)
 {
 	struct page *page, *next;
 
-	list_for_each_entry_safe(page, next, list, lru)
-		free_vmemmap_page(page);
+	list_for_each_entry_safe(page, next, list, lru) {
+		if (PageReserved(page)) {
+			memmap_boot_pages_add(-1);
+			free_reserved_page(page);
+		} else {
+			memmap_pages_add(-1);
+			__free_page(page);
+		}
+	}
 }
 
 static int alloc_vmemmap_page_list(struct list_head *head,
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

* + mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning Muchun Song
@ 2026-12-01 21:27   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:27 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/hugetlb_vmemmap: drop obsolete restore refcount warning
has been added to the -mm mm-new branch.  Its filename is
     mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/hugetlb_vmemmap: drop obsolete restore refcount warning
Date: Tue, 01 Dec 2026 17:58:39 +0800

Commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative
PFN walkers") added this warning alongside RCU protection that
serialized page_ref_add_unless() against HVO remapping. The zero head
refcount was part of that protocol while the vmemmap was folded or
unfolded.

That RCU protection was later removed by commit 32c440d67e6c ("mm:
drop fake head checks") and commit 01b1d0ffb6f7 ("hugetlb: remove
VMEMMAP_SYNCHRONIZE_RCU"). Commit 0120a603afad
("mm/hugetlb_vmemmap: map the shared tail page writable") now handles
the original race by allowing a late cmpxchg to fail safely against
the zero refcount on the shared tail page.

The head folio refcount no longer participates in this protection.
Drop the stale warning from the restore path.

The matching warning in the optimize path remains necessary because
that path copies the head struct page. A zero refcount prevents
concurrent users from acquiring a reference and writing to it during
the copy. Document this requirement at the warning.

Link: https://patch.msgid.link/20261201095840.3034368-6-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 mm/hugetlb_vmemmap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/mm/hugetlb_vmemmap.c~mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning
+++ a/mm/hugetlb_vmemmap.c
@@ -348,6 +348,11 @@ static int vmemmap_optimize_folio(const
 
 	rwsem_assert_held(&vmemmap_remap_rwsem);
 
+	/*
+	 * The refcount must remain zero to prevent concurrent users from
+	 * acquiring a reference and writing to the head struct page while it
+	 * is copied during remapping.
+	 */
 	VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio), folio);
 
 	if (!vmemmap_optimizable_order(folio_order(folio)))
@@ -408,7 +413,6 @@ static int __hugetlb_vmemmap_restore_fol
 	int ret;
 
 	VM_WARN_ON_ONCE_FOLIO(!folio_test_hugetlb(folio), folio);
-	VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio), folio);
 
 	if (!folio_test_hugetlb_vmemmap_optimized(folio))
 		return 0;
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

* + mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch added to mm-new branch
  2026-12-01  9:58 ` [PATCH v2 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check Muchun Song
@ 2026-12-01 21:27   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-12-01 21:27 UTC (permalink / raw)
  To: mm-commits, rppt, qi.zheng, osalvador, nobody, lance.yang, david,
	songmuchun, akpm


The patch titled
     Subject: mm/vmemmap-optimization: centralize the vmemmap optimization support check
has been added to the -mm mm-new branch.  Its filename is
     mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/vmemmap-optimization: centralize the vmemmap optimization support check
Date: Tue, 01 Dec 2026 17:58:40 +0800

Whether vmemmap optimization is supported depends on both the configuration
and struct page having a power-of-two size. Open-coding this condition
in several places makes the support contract easy to duplicate.

Express this contract once in vmemmap_optimization_supported(). Make the
existing checks use it.

No functional change intended.

Link: https://patch.msgid.link/20261201095840.3034368-7-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: nobody <nobody@kernel.org>

 include/linux/page-flags.h           |   10 ++++++----
 include/linux/vmemmap-optimization.h |   14 +++-----------
 2 files changed, 9 insertions(+), 15 deletions(-)

--- a/include/linux/page-flags.h~mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check
+++ a/include/linux/page-flags.h
@@ -193,6 +193,11 @@ enum pageflags {
 #define PAGEFLAGS_MASK		((1UL << NR_PAGEFLAGS) - 1)
 
 #ifndef __GENERATING_BOUNDS_H
+static __always_inline bool vmemmap_optimization_supported(void)
+{
+	return IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION) &&
+	       is_power_of_2(sizeof(struct page));
+}
 
 /*
  * For tail pages, if the size of struct page is power-of-2 ->compound_info
@@ -210,10 +215,7 @@ static __always_inline bool compound_inf
 	 * but it requires validating that struct pages are naturally aligned
 	 * for all orders up to the MAX_FOLIO_ORDER, which can be tricky.
 	 */
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	return is_power_of_2(sizeof(struct page));
+	return vmemmap_optimization_supported();
 }
 
 static __always_inline unsigned long _compound_head(const struct page *page)
--- a/include/linux/vmemmap-optimization.h~mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check
+++ a/include/linux/vmemmap-optimization.h
@@ -21,9 +21,7 @@
  * HVO which is only active if the size of struct page is a power of 2.
  */
 #define MAX_FOLIO_VMEMMAP_ALIGN					\
-	(IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION) &&		\
-	 is_power_of_2(sizeof(struct page)) ?			\
-	 MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0)
+	(vmemmap_optimization_supported() ? MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0)
 
 /* The number of retained vmemmap pages with HVO enabled. */
 #define VMEMMAP_OPTIMIZATION_PAGES		1
@@ -33,10 +31,7 @@
 
 static inline bool vmemmap_optimizable_order(unsigned int order)
 {
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	if (!is_power_of_2(sizeof(struct page)))
+	if (!vmemmap_optimization_supported())
 		return false;
 
 	return order >= VMEMMAP_OPTIMIZATION_MIN_ORDER;
@@ -115,10 +110,7 @@ static inline bool vmemmap_optimizable_p
 {
 	const unsigned long nr_pages = 1UL << order;
 
-	if (!IS_ENABLED(CONFIG_VMEMMAP_OPTIMIZATION))
-		return false;
-
-	if (!is_power_of_2(sizeof(struct page)))
+	if (!vmemmap_optimization_supported())
 		return false;
 
 	return (pfn & (nr_pages - 1)) >= VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES;
_

Patches currently in -mm which might be from songmuchun@bytedance.com are

powerpc-mm-make-vmemmap_populate_compound_pages-static.patch
powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch
mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch
mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch
mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch
mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch
mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch
mm-mm_init-verify-zones-for-template-initialized-pages.patch
mm-mm_init-factor-out-common-struct-page-initialization.patch
mm-mm_init-simplify-zone-device-page-initialization.patch
mm-mm_init-factor-out-compound-page-initialization.patch
mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch
mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch
mm-hugetlb-use-common-compound-page-initialization-helper.patch
mm-mm_init-make-__init_single_page-static.patch
mm-cma-centralize-cma-pageblock-initialization.patch
mm-cma-localize-init_cma_pageblock-to-cmac.patch
mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch
kmsan-encapsulate-per-page-metadata-access.patch
mm-page_ext-fix-client-data-alignment.patch
mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch
mm-page_ext-use-common-allocation-and-initialization-entry-points.patch
mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch
mm-page_ext-inline-unchecked-page-extension-lookup.patch
kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch
mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch
mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch
mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch
mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch
mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch
mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-12-01 21:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  9:58 [PATCH v2 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
2026-12-01  9:58 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
2026-12-01 21:26   ` + mm-hugetlb_vmemmap-remove-the-vmemmap-savings-boot-message.patch added to mm-new branch Andrew Morton
2026-12-01  9:58 ` [PATCH v2 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers Muchun Song
2026-12-01 21:26   ` + mm-hugetlb_vmemmap-fold-vmemmap_should_optimize-into-its-callers.patch added to mm-new branch Andrew Morton
2026-12-01  9:58 ` [PATCH v2 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument Muchun Song
2026-12-01 21:26   ` + mm-hugetlb_vmemmap-drop-the-redundant-hstate-argument.patch added to mm-new branch Andrew Morton
2026-12-01  9:58 ` [PATCH v2 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page() Muchun Song
2026-12-01 21:27   ` + mm-hugetlb_vmemmap-open-code-free_vmemmap_page.patch added to mm-new branch Andrew Morton
2026-12-01  9:58 ` [PATCH v2 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning Muchun Song
2026-12-01 21:27   ` + mm-hugetlb_vmemmap-drop-obsolete-restore-refcount-warning.patch added to mm-new branch Andrew Morton
2026-12-01  9:58 ` [PATCH v2 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check Muchun Song
2026-12-01 21:27   ` + mm-vmemmap-optimization-centralize-the-vmemmap-optimization-support-check.patch added to mm-new branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.