Skip to contentSkip to conversation

mm-memory-introduce-is_huge_zero_pfn-and-use-it-in-vm_normal_page_pmd.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jul 25, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/memory: introduce is_huge_zero_pfn() and use it in vm_normal_page_pmd()
has been removed from the -mm tree. Its filename was
mm-memory-introduce-is_huge_zero_pfn-and-use-it-in-vm_normal_page_pmd.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: David Hildenbrand <[email protected]>
Subject: mm/memory: introduce is_huge_zero_pfn() and use it in vm_normal_page_pmd()
Date: Mon, 14 Jul 2025 09:16:51 -0400

Patch series "mm: introduce snapshot_page()", v3.

This series introduces snapshot_page(), a helper function that can be used to create a snapshot of a struct page and its associated struct folio.

This function is intended to help callers with a consistent view of a a folio while reducing the chance of encountering partially updated or inconsistent state, such as during folio splitting which could lead to crashes and BUG_ON()s being triggered.

This patch (of 4):

Let's avoid working with the PMD when not required. If vm_normal_page_pmd() would be called on something that is not a present pmd, it would already be a bug (pfn possibly garbage).

While at it, let's support passing in any pfn covered by the huge zero folio by masking off PFN bits -- which should be rather cheap.

---

 include/linux/huge_mm.h |   12 +++++++++++-
 mm/memory.c             |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-memory-introduce-is_huge_zero_pfn-and-use-it-in-vm_normal_page_pmd +11 -1
@@ -482,9 +482,14 @@ static inline bool is_huge_zero_folio(co
 	return READ_ONCE(huge_zero_folio) == folio;
 }
 
+static inline bool is_huge_zero_pfn(unsigned long pfn)
+{
+	return READ_ONCE(huge_zero_pfn) == (pfn & ~(HPAGE_PMD_NR - 1));
+}
+
 static inline bool is_huge_zero_pmd(pmd_t pmd)
 {
-	return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd);
+	return pmd_present(pmd) && is_huge_zero_pfn(pmd_pfn(pmd));
 }
 
 struct folio *mm_get_huge_zero_folio(struct mm_struct *mm);
@@ -631,6 +636,11 @@ static inline bool is_huge_zero_folio(co
 {
 	return false;
 }
+
+static inline bool is_huge_zero_pfn(unsigned long pfn)
+{
+	return false;
+}
 
 static inline bool is_huge_zero_pmd(pmd_t pmd)
 {
mm/memory.c renamed from mm/memory.c~mm-memory-introduce-is_huge_zero_pfn-and-use-it-in-vm_normal_page_pmd +1 -1
@@ -668,7 +668,7 @@ struct page *vm_normal_page_pmd(struct v
 		}
 	}
 
-	if (is_huge_zero_pmd(pmd))
+	if (is_huge_zero_pfn(pfn))
 		return NULL;
 	if (unlikely(pfn > highest_memmap_pfn))
 		return NULL;

_

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

mm-add-get_and_clear_ptes-and-clear_ptes.patch