4 #include <linux/swap.h>
5 #include <asm/pgalloc.h>
6 #include <asm/tlbflush.h>
7 #include <asm/mmu_context.h>
9 #define TLB_BATCH_NR 192
12 * For UP we don't need to worry about TLB flush
13 * and page free order so much..
16 #define FREE_PTE_NR 506
17 #define tlb_fast_mode(bp) ((bp)->pages_nr == ~0U)
20 #define tlb_fast_mode(bp) 1
25 unsigned int pages_nr
;
26 unsigned int need_flush
;
29 unsigned long vaddrs
[TLB_BATCH_NR
];
30 struct page
*pages
[FREE_PTE_NR
];
33 DECLARE_PER_CPU(struct mmu_gather
, mmu_gathers
);
36 extern void smp_flush_tlb_pending(struct mm_struct
*,
37 unsigned long, unsigned long *);
40 extern void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *);
41 extern void flush_tlb_pending(void);
43 static inline struct mmu_gather
*tlb_gather_mmu(struct mm_struct
*mm
, unsigned int full_mm_flush
)
45 struct mmu_gather
*mp
= &get_cpu_var(mmu_gathers
);
50 mp
->pages_nr
= num_online_cpus() > 1 ? 0U : ~0U;
51 mp
->fullmm
= full_mm_flush
;
57 static inline void tlb_flush_mmu(struct mmu_gather
*mp
)
60 free_pages_and_swap_cache(mp
->pages
, mp
->pages_nr
);
68 extern void smp_flush_tlb_mm(struct mm_struct
*mm
);
69 #define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
71 #define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT)
74 static inline void tlb_finish_mmu(struct mmu_gather
*mp
, unsigned long start
, unsigned long end
)
83 /* keep the page table cache within bounds */
86 put_cpu_var(mmu_gathers
);
89 static inline void tlb_remove_page(struct mmu_gather
*mp
, struct page
*page
)
91 if (tlb_fast_mode(mp
)) {
92 free_page_and_swap_cache(page
);
96 mp
->pages
[mp
->pages_nr
++] = page
;
97 if (mp
->pages_nr
>= FREE_PTE_NR
)
101 #define tlb_remove_tlb_entry(mp,ptep,addr) do { } while (0)
102 #define pte_free_tlb(mp,ptepage) pte_free(ptepage)
103 #define pmd_free_tlb(mp,pmdp) pmd_free(pmdp)
104 #define pud_free_tlb(tlb,pudp) __pud_free_tlb(tlb,pudp)
106 #define tlb_migrate_finish(mm) do { } while (0)
107 #define tlb_start_vma(tlb, vma) do { } while (0)
108 #define tlb_end_vma(tlb, vma) do { } while (0)
110 #endif /* _SPARC64_TLB_H */