MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-arm26 / tlb.h
blobb58e2597667d77e623da3e6bddd7ce46d1e55db4
1 #ifndef __ASMARM_TLB_H
2 #define __ASMARM_TLB_H
4 #include <asm/pgalloc.h>
5 #include <asm/tlbflush.h>
7 /*
8 * TLB handling. This allows us to remove pages from the page
9 * tables, and efficiently handle the TLB issues.
11 struct mmu_gather {
12 struct mm_struct *mm;
13 unsigned int freed;
15 unsigned int flushes;
16 unsigned int avoided_flushes;
19 extern struct mmu_gather mmu_gathers[NR_CPUS];
21 static inline struct mmu_gather *
22 tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
24 int cpu = smp_processor_id();
25 struct mmu_gather *tlb = &mmu_gathers[cpu];
27 tlb->mm = mm;
28 tlb->freed = 0;
30 return tlb;
33 static inline void
34 tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
36 struct mm_struct *mm = tlb->mm;
37 unsigned long freed = tlb->freed;
38 int rss = mm->rss;
40 if (rss < freed)
41 freed = rss;
42 mm->rss = rss - freed;
44 if (freed) {
45 flush_tlb_mm(mm);
46 tlb->flushes++;
47 } else {
48 tlb->avoided_flushes++;
51 /* keep the page table cache within bounds */
52 check_pgt_cache();
55 #define tlb_remove_tlb_entry(tlb,ptep,address) do { } while (0)
56 #define tlb_start_vma(tlb,vma) do { } while (0)
57 #define tlb_end_vma(tlb,vma) do { } while (0)
59 #define tlb_remove_page(tlb,page) free_page_and_swap_cache(page)
60 #define pte_free_tlb(tlb,ptep) pte_free(ptep)
61 #define pmd_free_tlb(tlb,pmdp) pmd_free(pmdp)
63 #endif