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