Lines Matching refs:tlb
16 static bool tlb_next_batch(struct mmu_gather *tlb) in tlb_next_batch() argument
20 batch = tlb->active; in tlb_next_batch()
22 tlb->active = batch->next; in tlb_next_batch()
26 if (tlb->batch_count == MAX_GATHER_BATCH_COUNT) in tlb_next_batch()
33 tlb->batch_count++; in tlb_next_batch()
38 tlb->active->next = batch; in tlb_next_batch()
39 tlb->active = batch; in tlb_next_batch()
44 static void tlb_batch_pages_flush(struct mmu_gather *tlb) in tlb_batch_pages_flush() argument
48 for (batch = &tlb->local; batch && batch->nr; batch = batch->next) { in tlb_batch_pages_flush()
52 tlb->active = &tlb->local; in tlb_batch_pages_flush()
55 static void tlb_batch_list_free(struct mmu_gather *tlb) in tlb_batch_list_free() argument
59 for (batch = tlb->local.next; batch; batch = next) { in tlb_batch_list_free()
63 tlb->local.next = NULL; in tlb_batch_list_free()
66 bool __tlb_remove_page_size(struct mmu_gather *tlb, struct page *page, int page_size) in __tlb_remove_page_size() argument
70 VM_BUG_ON(!tlb->end); in __tlb_remove_page_size()
73 VM_WARN_ON(tlb->page_size != page_size); in __tlb_remove_page_size()
76 batch = tlb->active; in __tlb_remove_page_size()
83 if (!tlb_next_batch(tlb)) in __tlb_remove_page_size()
85 batch = tlb->active; in __tlb_remove_page_size()
176 static inline void tlb_table_invalidate(struct mmu_gather *tlb) in tlb_table_invalidate() argument
184 tlb_flush_mmu_tlbonly(tlb); in tlb_table_invalidate()
194 static void tlb_table_flush(struct mmu_gather *tlb) in tlb_table_flush() argument
196 struct mmu_table_batch **batch = &tlb->batch; in tlb_table_flush()
199 tlb_table_invalidate(tlb); in tlb_table_flush()
205 void tlb_remove_table(struct mmu_gather *tlb, void *table) in tlb_remove_table() argument
207 struct mmu_table_batch **batch = &tlb->batch; in tlb_remove_table()
212 tlb_table_invalidate(tlb); in tlb_remove_table()
221 tlb_table_flush(tlb); in tlb_remove_table()
224 static inline void tlb_table_init(struct mmu_gather *tlb) in tlb_table_init() argument
226 tlb->batch = NULL; in tlb_table_init()
231 static inline void tlb_table_flush(struct mmu_gather *tlb) { } in tlb_table_flush() argument
232 static inline void tlb_table_init(struct mmu_gather *tlb) { } in tlb_table_init() argument
236 static void tlb_flush_mmu_free(struct mmu_gather *tlb) in tlb_flush_mmu_free() argument
238 tlb_table_flush(tlb); in tlb_flush_mmu_free()
240 tlb_batch_pages_flush(tlb); in tlb_flush_mmu_free()
244 void tlb_flush_mmu(struct mmu_gather *tlb) in tlb_flush_mmu() argument
246 tlb_flush_mmu_tlbonly(tlb); in tlb_flush_mmu()
247 tlb_flush_mmu_free(tlb); in tlb_flush_mmu()
262 void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, in tlb_gather_mmu() argument
265 tlb->mm = mm; in tlb_gather_mmu()
268 tlb->fullmm = !(start | (end+1)); in tlb_gather_mmu()
271 tlb->need_flush_all = 0; in tlb_gather_mmu()
272 tlb->local.next = NULL; in tlb_gather_mmu()
273 tlb->local.nr = 0; in tlb_gather_mmu()
274 tlb->local.max = ARRAY_SIZE(tlb->__pages); in tlb_gather_mmu()
275 tlb->active = &tlb->local; in tlb_gather_mmu()
276 tlb->batch_count = 0; in tlb_gather_mmu()
279 tlb_table_init(tlb); in tlb_gather_mmu()
281 tlb->page_size = 0; in tlb_gather_mmu()
284 __tlb_reset_range(tlb); in tlb_gather_mmu()
285 inc_tlb_flush_pending(tlb->mm); in tlb_gather_mmu()
297 void tlb_finish_mmu(struct mmu_gather *tlb, in tlb_finish_mmu() argument
312 if (mm_tlb_flush_nested(tlb->mm)) { in tlb_finish_mmu()
321 tlb->fullmm = 1; in tlb_finish_mmu()
322 __tlb_reset_range(tlb); in tlb_finish_mmu()
323 tlb->freed_tables = 1; in tlb_finish_mmu()
326 tlb_flush_mmu(tlb); in tlb_finish_mmu()
329 tlb_batch_list_free(tlb); in tlb_finish_mmu()
331 dec_tlb_flush_pending(tlb->mm); in tlb_finish_mmu()