Patchwork [-V9,18/20] powerpc: disable assert_pte_locked for collapse_huge_page

mail settings
Submitter Aneesh Kumar K.V
Date May 22, 2013, 4:57 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/245685/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show


Aneesh Kumar K.V - May 22, 2013, 4:57 p.m.
From: "Aneesh Kumar K.V" <>

With THP we set pmd to none, before we do pte_clear. Hence we can't
walk page table to get the pte lock ptr and verify whether it is locked.
THP do take pte lock before calling pte_clear. So we don't change the locking
rules here. It is that we can't use page table walking to check whether
pte locks are held with THP.

Signed-off-by: Aneesh Kumar K.V <>
 arch/powerpc/mm/pgtable.c | 8 ++++++++
 1 file changed, 8 insertions(+)


diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 214130a..edda589 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -235,6 +235,14 @@  void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
 	pud = pud_offset(pgd, addr);
 	pmd = pmd_offset(pud, addr);
+	/*
+	 * khugepaged to collapse normal pages to hugepage, first set
+	 * pmd to none to force page fault/gup to take mmap_sem. After
+	 * pmd is set to none, we do a pte_clear which does this assertion
+	 * so if we find pmd none, return.
+	 */
+	if (pmd_none(*pmd))
+		return;
 	assert_spin_locked(pte_lockptr(mm, pmd));