|
@@ -189,6 +189,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
|
|
{
|
|
{
|
|
unsigned long addr;
|
|
unsigned long addr;
|
|
unsigned act_entries, tlb_entries = 0;
|
|
unsigned act_entries, tlb_entries = 0;
|
|
|
|
+ unsigned long nr_base_pages;
|
|
|
|
|
|
preempt_disable();
|
|
preempt_disable();
|
|
if (current->active_mm != mm)
|
|
if (current->active_mm != mm)
|
|
@@ -210,18 +211,17 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
|
|
tlb_entries = tlb_lli_4k[ENTRIES];
|
|
tlb_entries = tlb_lli_4k[ENTRIES];
|
|
else
|
|
else
|
|
tlb_entries = tlb_lld_4k[ENTRIES];
|
|
tlb_entries = tlb_lld_4k[ENTRIES];
|
|
|
|
+
|
|
/* Assume all of TLB entries was occupied by this task */
|
|
/* Assume all of TLB entries was occupied by this task */
|
|
- act_entries = mm->total_vm > tlb_entries ? tlb_entries : mm->total_vm;
|
|
|
|
|
|
+ act_entries = tlb_entries >> tlb_flushall_shift;
|
|
|
|
+ act_entries = mm->total_vm > act_entries ? act_entries : mm->total_vm;
|
|
|
|
+ nr_base_pages = (end - start) >> PAGE_SHIFT;
|
|
|
|
|
|
/* tlb_flushall_shift is on balance point, details in commit log */
|
|
/* tlb_flushall_shift is on balance point, details in commit log */
|
|
- if ((end - start) >> PAGE_SHIFT > act_entries >> tlb_flushall_shift) {
|
|
|
|
|
|
+ if (nr_base_pages > act_entries || has_large_page(mm, start, end)) {
|
|
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
|
|
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
|
|
local_flush_tlb();
|
|
local_flush_tlb();
|
|
} else {
|
|
} else {
|
|
- if (has_large_page(mm, start, end)) {
|
|
|
|
- local_flush_tlb();
|
|
|
|
- goto flush_all;
|
|
|
|
- }
|
|
|
|
/* flush range by one by one 'invlpg' */
|
|
/* flush range by one by one 'invlpg' */
|
|
for (addr = start; addr < end; addr += PAGE_SIZE) {
|
|
for (addr = start; addr < end; addr += PAGE_SIZE) {
|
|
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE);
|
|
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE);
|