Skip to contentSkip to conversation

mm-hmm-process-pud-swap-entry-without-pud_huge.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 26, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/hmm: process pud swap entry without pud_huge()
has been removed from the -mm tree. Its filename was
mm-hmm-process-pud-swap-entry-without-pud_huge.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/hmm: process pud swap entry without pud_huge()
Date: Mon, 18 Mar 2024 16:03:51 -0400

Swap pud entries do not always return true for pud_huge() for all archs. x86 and sparc (so far) allow it, but all the rest do not accept a swap entry to be reported as pud_huge(). So it's not safe to check swap entries within pud_huge(). Check swap entries before pud_huge(), so it should be always safe.

This is the only place in the kernel that (IMHO, wrongly) relies on pud_huge() to return true on pud swap entries. The plan is to cleanup pXd_huge() to only report non-swap mappings for all archs.

Cc Alistair Popple <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc "Aneesh Kumar K.V" <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Dave Hansen <[email protected]>
Cc David S. Miller <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Konrad Dybcio <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Mark Salter <[email protected]>
Cc "Matthew Wilcox (Oracle)" <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Mike Rapoport (IBM) <[email protected]>
Cc Muchun Song <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc "Naveen N. Rao" <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Will Deacon <[email protected]>

---

 mm/hmm.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
mm/hmm.c renamed from mm/hmm.c~mm-hmm-process-pud-swap-entry-without-pud_huge +1 -6
@@ -424,7 +424,7 @@ static int hmm_vma_walk_pud(pud_t *pudp,
 	walk->action = ACTION_CONTINUE;
 
 	pud = READ_ONCE(*pudp);
-	if (pud_none(pud)) {
+	if (!pud_present(pud)) {
 		spin_unlock(ptl);
 		return hmm_vma_walk_hole(start, end, -1, walk);
 	}
@@ -435,11 +435,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
 		unsigned long *hmm_pfns;
 		unsigned long cpu_flags;
 
-		if (!pud_present(pud)) {
-			spin_unlock(ptl);
-			return hmm_vma_walk_hole(start, end, -1, walk);
-		}
-
 		i = (addr - range->start) >> PAGE_SHIFT;
 		npages = (end - addr) >> PAGE_SHIFT;
 		hmm_pfns = &range->hmm_pfns[i];

_

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

mm-userfaultfd-reset-ptes-when-close-for-wr-protected-ones.patch mm-hugetlb-assert-hugetlb_lock-in-__hugetlb_cgroup_commit_charge.patch mm-page_table_check-support-userfault-wr-protect-entries.patch