powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split

This change “powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split” (commit 346519a) in Linux kernel is authored by Aneesh Kumar K.V <aneesh.kumar [at] linux.vnet.ibm.com> on Sat Mar 15 16:17:58 2014 +0530.

Description of "powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split"

The change “powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split” introduces changes as follows.

powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split

We have generic code like the one in get_futex_key that assume that
a local_irq_disable prevents a parallel THP split. Support that by
adding a dummy smp call function after setting _PAGE_SPLITTING. Code
paths like get_user_pages_fast still need to check for _PAGE_SPLITTING
after disabling IRQ which indicate that a parallel THP splitting is
ongoing. Now if they don't find _PAGE_SPLITTING set, then we can be
sure that parallel split will now block in pmdp_splitting flush
until we enables IRQ

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Linux kernel releases containing commit 346519a

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "powerpc/mm: Make sure a local_irq_disable prevent a parallel THP split"

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/powerpc/mm/pgtable_64.c | 5 +++++
 1 file changed, 5 insertions(+)
 
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 62bf5e8e78da..f6ce1f111f5b 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -647,6 +647,11 @@ void pmdp_splitting_flush(struct vm_area_struct *vma,
 		if (old & _PAGE_HASHPTE)
 			hpte_do_hugepage_flush(vma->vm_mm, address, pmdp);
 	}
+	/*
+	 * This ensures that generic code that rely on IRQ disabling
+	 * to prevent a parallel THP split work as expected.
+	 */
+	kick_all_cpus_sync();
 }
 
 /*

The commit for this change in Linux stable tree is 346519a (patch).

Last modified: 2020/02/10