patch-2.6.6-vs1.9.0
[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         vx_rsspages_sub(mm, freed);
43
44         if (freed) {
45                 flush_tlb_mm(mm);
46                 tlb->flushes++;
47         } else {
48                 tlb->avoided_flushes++;
49         }
50
51         /* keep the page table cache within bounds */
52         check_pgt_cache();
53 }
54
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)
58
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)
62
63 #endif