diff options
Diffstat (limited to 'include/asm-generic/tlb.h')
-rw-r--r-- | include/asm-generic/tlb.h | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 7d0298347ee7..cdd4145243cd 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
@@ -35,16 +35,13 @@ | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* struct mmu_gather is an opaque type used by the mm code for passing around | 37 | /* struct mmu_gather is an opaque type used by the mm code for passing around |
38 | * any data needed by arch specific code for tlb_remove_page. This structure | 38 | * any data needed by arch specific code for tlb_remove_page. |
39 | * can be per-CPU or per-MM as the page table lock is held for the duration of | ||
40 | * TLB shootdown. | ||
41 | */ | 39 | */ |
42 | struct mmu_gather { | 40 | struct mmu_gather { |
43 | struct mm_struct *mm; | 41 | struct mm_struct *mm; |
44 | unsigned int nr; /* set to ~0U means fast mode */ | 42 | unsigned int nr; /* set to ~0U means fast mode */ |
45 | unsigned int need_flush;/* Really unmapped some ptes? */ | 43 | unsigned int need_flush;/* Really unmapped some ptes? */ |
46 | unsigned int fullmm; /* non-zero means full mm flush */ | 44 | unsigned int fullmm; /* non-zero means full mm flush */ |
47 | unsigned long freed; | ||
48 | struct page * pages[FREE_PTE_NR]; | 45 | struct page * pages[FREE_PTE_NR]; |
49 | }; | 46 | }; |
50 | 47 | ||
@@ -57,7 +54,7 @@ DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); | |||
57 | static inline struct mmu_gather * | 54 | static inline struct mmu_gather * |
58 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | 55 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) |
59 | { | 56 | { |
60 | struct mmu_gather *tlb = &per_cpu(mmu_gathers, smp_processor_id()); | 57 | struct mmu_gather *tlb = &get_cpu_var(mmu_gathers); |
61 | 58 | ||
62 | tlb->mm = mm; | 59 | tlb->mm = mm; |
63 | 60 | ||
@@ -65,7 +62,6 @@ tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | |||
65 | tlb->nr = num_online_cpus() > 1 ? 0U : ~0U; | 62 | tlb->nr = num_online_cpus() > 1 ? 0U : ~0U; |
66 | 63 | ||
67 | tlb->fullmm = full_mm_flush; | 64 | tlb->fullmm = full_mm_flush; |
68 | tlb->freed = 0; | ||
69 | 65 | ||
70 | return tlb; | 66 | return tlb; |
71 | } | 67 | } |
@@ -85,28 +81,17 @@ tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | |||
85 | 81 | ||
86 | /* tlb_finish_mmu | 82 | /* tlb_finish_mmu |
87 | * Called at the end of the shootdown operation to free up any resources | 83 | * Called at the end of the shootdown operation to free up any resources |
88 | * that were required. The page table lock is still held at this point. | 84 | * that were required. |
89 | */ | 85 | */ |
90 | static inline void | 86 | static inline void |
91 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | 87 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) |
92 | { | 88 | { |
93 | int freed = tlb->freed; | ||
94 | struct mm_struct *mm = tlb->mm; | ||
95 | int rss = get_mm_counter(mm, rss); | ||
96 | |||
97 | if (rss < freed) | ||
98 | freed = rss; | ||
99 | add_mm_counter(mm, rss, -freed); | ||
100 | tlb_flush_mmu(tlb, start, end); | 89 | tlb_flush_mmu(tlb, start, end); |
101 | 90 | ||
102 | /* keep the page table cache within bounds */ | 91 | /* keep the page table cache within bounds */ |
103 | check_pgt_cache(); | 92 | check_pgt_cache(); |
104 | } | ||
105 | 93 | ||
106 | static inline unsigned int | 94 | put_cpu_var(mmu_gathers); |
107 | tlb_is_full_mm(struct mmu_gather *tlb) | ||
108 | { | ||
109 | return tlb->fullmm; | ||
110 | } | 95 | } |
111 | 96 | ||
112 | /* tlb_remove_page | 97 | /* tlb_remove_page |