diff options
| -rw-r--r-- | include/asm-generic/tlb.h | 8 | ||||
| -rw-r--r-- | mm/memory.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 08848050922e..db284bff29dc 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
| @@ -136,8 +136,12 @@ static inline void __tlb_adjust_range(struct mmu_gather *tlb, | |||
| 136 | 136 | ||
| 137 | static inline void __tlb_reset_range(struct mmu_gather *tlb) | 137 | static inline void __tlb_reset_range(struct mmu_gather *tlb) |
| 138 | { | 138 | { |
| 139 | tlb->start = TASK_SIZE; | 139 | if (tlb->fullmm) { |
| 140 | tlb->end = 0; | 140 | tlb->start = tlb->end = ~0; |
| 141 | } else { | ||
| 142 | tlb->start = TASK_SIZE; | ||
| 143 | tlb->end = 0; | ||
| 144 | } | ||
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | /* | 147 | /* |
diff --git a/mm/memory.c b/mm/memory.c index c6565f00fb38..54f3a9b00956 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -235,6 +235,9 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long | |||
| 235 | 235 | ||
| 236 | static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) | 236 | static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) |
| 237 | { | 237 | { |
| 238 | if (!tlb->end) | ||
| 239 | return; | ||
| 240 | |||
| 238 | tlb_flush(tlb); | 241 | tlb_flush(tlb); |
| 239 | mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end); | 242 | mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end); |
| 240 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | 243 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE |
| @@ -247,7 +250,7 @@ static void tlb_flush_mmu_free(struct mmu_gather *tlb) | |||
| 247 | { | 250 | { |
| 248 | struct mmu_gather_batch *batch; | 251 | struct mmu_gather_batch *batch; |
| 249 | 252 | ||
| 250 | for (batch = &tlb->local; batch; batch = batch->next) { | 253 | for (batch = &tlb->local; batch && batch->nr; batch = batch->next) { |
| 251 | free_pages_and_swap_cache(batch->pages, batch->nr); | 254 | free_pages_and_swap_cache(batch->pages, batch->nr); |
| 252 | batch->nr = 0; | 255 | batch->nr = 0; |
| 253 | } | 256 | } |
| @@ -256,9 +259,6 @@ static void tlb_flush_mmu_free(struct mmu_gather *tlb) | |||
| 256 | 259 | ||
| 257 | void tlb_flush_mmu(struct mmu_gather *tlb) | 260 | void tlb_flush_mmu(struct mmu_gather *tlb) |
| 258 | { | 261 | { |
| 259 | if (!tlb->end) | ||
| 260 | return; | ||
| 261 | |||
| 262 | tlb_flush_mmu_tlbonly(tlb); | 262 | tlb_flush_mmu_tlbonly(tlb); |
| 263 | tlb_flush_mmu_free(tlb); | 263 | tlb_flush_mmu_free(tlb); |
| 264 | } | 264 | } |
