aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/mm/memory.c b/mm/memory.c
index d5f2ae9c4a23..0b3f6c71620d 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -220,9 +220,6 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long
220 /* Is it from 0 to ~0? */ 220 /* Is it from 0 to ~0? */
221 tlb->fullmm = !(start | (end+1)); 221 tlb->fullmm = !(start | (end+1));
222 tlb->need_flush_all = 0; 222 tlb->need_flush_all = 0;
223 tlb->start = start;
224 tlb->end = end;
225 tlb->need_flush = 0;
226 tlb->local.next = NULL; 223 tlb->local.next = NULL;
227 tlb->local.nr = 0; 224 tlb->local.nr = 0;
228 tlb->local.max = ARRAY_SIZE(tlb->__pages); 225 tlb->local.max = ARRAY_SIZE(tlb->__pages);
@@ -232,15 +229,20 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long
232#ifdef CONFIG_HAVE_RCU_TABLE_FREE 229#ifdef CONFIG_HAVE_RCU_TABLE_FREE
233 tlb->batch = NULL; 230 tlb->batch = NULL;
234#endif 231#endif
232
233 __tlb_reset_range(tlb);
235} 234}
236 235
237static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) 236static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
238{ 237{
239 tlb->need_flush = 0; 238 if (!tlb->end)
239 return;
240
240 tlb_flush(tlb); 241 tlb_flush(tlb);
241#ifdef CONFIG_HAVE_RCU_TABLE_FREE 242#ifdef CONFIG_HAVE_RCU_TABLE_FREE
242 tlb_table_flush(tlb); 243 tlb_table_flush(tlb);
243#endif 244#endif
245 __tlb_reset_range(tlb);
244} 246}
245 247
246static void tlb_flush_mmu_free(struct mmu_gather *tlb) 248static void tlb_flush_mmu_free(struct mmu_gather *tlb)
@@ -256,8 +258,6 @@ static void tlb_flush_mmu_free(struct mmu_gather *tlb)
256 258
257void tlb_flush_mmu(struct mmu_gather *tlb) 259void tlb_flush_mmu(struct mmu_gather *tlb)
258{ 260{
259 if (!tlb->need_flush)
260 return;
261 tlb_flush_mmu_tlbonly(tlb); 261 tlb_flush_mmu_tlbonly(tlb);
262 tlb_flush_mmu_free(tlb); 262 tlb_flush_mmu_free(tlb);
263} 263}
@@ -292,7 +292,7 @@ int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
292{ 292{
293 struct mmu_gather_batch *batch; 293 struct mmu_gather_batch *batch;
294 294
295 VM_BUG_ON(!tlb->need_flush); 295 VM_BUG_ON(!tlb->end);
296 296
297 batch = tlb->active; 297 batch = tlb->active;
298 batch->pages[batch->nr++] = page; 298 batch->pages[batch->nr++] = page;
@@ -359,8 +359,6 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
359{ 359{
360 struct mmu_table_batch **batch = &tlb->batch; 360 struct mmu_table_batch **batch = &tlb->batch;
361 361
362 tlb->need_flush = 1;
363
364 /* 362 /*
365 * When there's less then two users of this mm there cannot be a 363 * When there's less then two users of this mm there cannot be a
366 * concurrent page-table walk. 364 * concurrent page-table walk.
@@ -1186,20 +1184,8 @@ again:
1186 arch_leave_lazy_mmu_mode(); 1184 arch_leave_lazy_mmu_mode();
1187 1185
1188 /* Do the actual TLB flush before dropping ptl */ 1186 /* Do the actual TLB flush before dropping ptl */
1189 if (force_flush) { 1187 if (force_flush)
1190 unsigned long old_end;
1191
1192 /*
1193 * Flush the TLB just for the previous segment,
1194 * then update the range to be the remaining
1195 * TLB range.
1196 */
1197 old_end = tlb->end;
1198 tlb->end = addr;
1199 tlb_flush_mmu_tlbonly(tlb); 1188 tlb_flush_mmu_tlbonly(tlb);
1200 tlb->start = addr;
1201 tlb->end = old_end;
1202 }
1203 pte_unmap_unlock(start_pte, ptl); 1189 pte_unmap_unlock(start_pte, ptl);
1204 1190
1205 /* 1191 /*