Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax
[linux-2.6-microblaze.git] / arch / powerpc / mm / mmu_context_book3s64.c
index 5a0cf2c..dbd8f76 100644 (file)
@@ -164,9 +164,9 @@ static void pte_frag_destroy(void *pte_frag)
        /* drop all the pending references */
        count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT;
        /* We allow PTE_FRAG_NR fragments from a PTE page */
-       if (page_ref_sub_and_test(page, PTE_FRAG_NR - count)) {
+       if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) {
                pgtable_page_dtor(page);
-               free_unref_page(page);
+               __free_page(page);
        }
 }
 
@@ -179,13 +179,13 @@ static void pmd_frag_destroy(void *pmd_frag)
        /* drop all the pending references */
        count = ((unsigned long)pmd_frag & ~PAGE_MASK) >> PMD_FRAG_SIZE_SHIFT;
        /* We allow PTE_FRAG_NR fragments from a PTE page */
-       if (page_ref_sub_and_test(page, PMD_FRAG_NR - count)) {
+       if (atomic_sub_and_test(PMD_FRAG_NR - count, &page->pt_frag_refcount)) {
                pgtable_pmd_page_dtor(page);
-               free_unref_page(page);
+               __free_page(page);
        }
 }
 
-static void destroy_pagetable_page(struct mm_struct *mm)
+static void destroy_pagetable_cache(struct mm_struct *mm)
 {
        void *frag;
 
@@ -208,13 +208,14 @@ void destroy_context(struct mm_struct *mm)
                WARN_ON(process_tb[mm->context.id].prtb0 != 0);
        else
                subpage_prot_free(mm);
-       destroy_pagetable_page(mm);
        destroy_contexts(&mm->context);
        mm->context.id = MMU_NO_CONTEXT;
 }
 
 void arch_exit_mmap(struct mm_struct *mm)
 {
+       destroy_pagetable_cache(mm);
+
        if (radix_enabled()) {
                /*
                 * Radix doesn't have a valid bit in the process table
@@ -237,15 +238,7 @@ void arch_exit_mmap(struct mm_struct *mm)
 #ifdef CONFIG_PPC_RADIX_MMU
 void radix__switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 {
-
-       if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
-               isync();
-               mtspr(SPRN_PID, next->context.id);
-               isync();
-               asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
-       } else {
-               mtspr(SPRN_PID, next->context.id);
-               isync();
-       }
+       mtspr(SPRN_PID, next->context.id);
+       isync();
 }
 #endif