powerpc/mm: Rework & cleanup page table freeing code path
[linux-2.6-block.git] / arch / powerpc / mm / tlb_hash64.c
index 937eb90677d9ef658b4a2e7d9ebd982a9e0820f7..8e35a6066938b73e7e24bd199dec72009781e482 100644 (file)
@@ -154,6 +154,21 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
        batch->index = 0;
 }
 
+void tlb_flush(struct mmu_gather *tlb)
+{
+       struct ppc64_tlb_batch *tlbbatch = &__get_cpu_var(ppc64_tlb_batch);
+
+       /* If there's a TLB batch pending, then we must flush it because the
+        * pages are going to be freed and we really don't want to have a CPU
+        * access a freed page because it has a stale TLB
+        */
+       if (tlbbatch->index)
+               __flush_tlb_pending(tlbbatch);
+
+       /* Push out batch of freed page tables */
+       pte_free_finish();
+}
+
 /**
  * __flush_hash_table_range - Flush all HPTEs for a given address range
  *                            from the hash table (and the TLB). But keeps