mm/THP: withdraw the pgtable after pmdp related operations
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Thu, 6 Jun 2013 00:14:04 +0000 (17:14 -0700)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 20 Jun 2013 06:55:07 +0000 (16:55 +1000)
For architectures like ppc64 we look at deposited pgtable when calling
pmdp_get_and_clear.  So do the pgtable_trans_huge_withdraw after finishing
pmdp related operations.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
mm/huge_memory.c

index 6b785e17b67936a71d0570af40a1a6dca01cb6d4..5c4fac2d239e5ce28858d550745fa249070824e7 100644 (file)
@@ -1360,9 +1360,15 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
                struct page *page;
                pgtable_t pgtable;
                pmd_t orig_pmd;
-               pgtable = pgtable_trans_huge_withdraw(tlb->mm, pmd);
+               /*
+                * For architectures like ppc64 we look at deposited pgtable
+                * when calling pmdp_get_and_clear. So do the
+                * pgtable_trans_huge_withdraw after finishing pmdp related
+                * operations.
+                */
                orig_pmd = pmdp_get_and_clear(tlb->mm, addr, pmd);
                tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
+               pgtable = pgtable_trans_huge_withdraw(tlb->mm, pmd);
                if (is_huge_zero_pmd(orig_pmd)) {
                        tlb->mm->nr_ptes--;
                        spin_unlock(&tlb->mm->page_table_lock);