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