Skip to contentSkip to conversation

mm-pagewalk-check-pfnmap-for-folio_walk_start.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 17, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/pagewalk: check pfnmap for folio_walk_start()
has been removed from the -mm tree. Its filename was
mm-pagewalk-check-pfnmap-for-folio_walk_start.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: Peter Xu <[email protected]>
Subject: mm/pagewalk: check pfnmap for folio_walk_start()
Date: Mon, 26 Aug 2024 16:43:40 -0400

Teach folio_walk_start() to recognize special pmd/pud mappings, and fail them properly as it means there's no folio backing them.

[[email protected]: remove some stale comments, per David]
Cc David Hildenbrand <[email protected]>
Cc Alexander Gordeev <[email protected]>
Cc Alex Williamson <[email protected]>
Cc Aneesh Kumar K.V <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Gavin Shan <[email protected]>
Cc Gerald Schaefer <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Niklas Schnelle <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc Sven Schnelle <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Will Deacon <[email protected]>
Cc Zi Yan <[email protected]>

---

 mm/memory.c   |    9 ++++-----
 mm/pagewalk.c |    2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)
mm/memory.c renamed from mm/memory.c~mm-pagewalk-check-pfnmap-for-folio_walk_start +4 -5
@@ -672,11 +672,10 @@ struct page *vm_normal_page_pmd(struct v
 {
 	unsigned long pfn = pmd_pfn(pmd);
 
-	/*
-	 * There is no pmd_special() but there may be special pmds, e.g.
-	 * in a direct-access (dax) mapping, so let's just replicate the
-	 * !CONFIG_ARCH_HAS_PTE_SPECIAL case from vm_normal_page() here.
-	 */
+	/* Currently it's only used for huge pfnmaps */
+	if (unlikely(pmd_special(pmd)))
+		return NULL;
+
 	if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
 		if (vma->vm_flags & VM_MIXEDMAP) {
 			if (!pfn_valid(pfn))
mm/pagewalk.c renamed from mm/pagewalk.c~mm-pagewalk-check-pfnmap-for-folio_walk_start +1 -1
@@ -753,7 +753,7 @@ struct folio *folio_walk_start(struct fo
 		fw->pudp = pudp;
 		fw->pud = pud;
 
-		if (!pud_present(pud) || pud_devmap(pud)) {
+		if (!pud_present(pud) || pud_devmap(pud) || pud_special(pud)) {
 			spin_unlock(ptl);
 			goto not_found;
 		} else if (!pud_leaf(pud)) {

_

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