Commit 38e3cbd9 authored by Anton Ivanov's avatar Anton Ivanov Committed by Richard Weinberger

um: Skip TLB flushing where not needed

Skip TLB flushing for all cases where it is not needed, not
just flush_tlb_mm_range
Signed-off-by: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent a9c52c2a
...@@ -520,6 +520,13 @@ pte_t *addr_pte(struct task_struct *task, unsigned long addr) ...@@ -520,6 +520,13 @@ pte_t *addr_pte(struct task_struct *task, unsigned long addr)
void flush_tlb_all(void) void flush_tlb_all(void)
{ {
/*
* Don't bother flushing if this address space is about to be
* destroyed.
*/
if (atomic_read(&current->mm->mm_users) == 0)
return;
flush_tlb_mm(current->mm); flush_tlb_mm(current->mm);
} }
...@@ -541,6 +548,13 @@ void __flush_tlb_one(unsigned long addr) ...@@ -541,6 +548,13 @@ void __flush_tlb_one(unsigned long addr)
static void fix_range(struct mm_struct *mm, unsigned long start_addr, static void fix_range(struct mm_struct *mm, unsigned long start_addr,
unsigned long end_addr, int force) unsigned long end_addr, int force)
{ {
/*
* Don't bother flushing if this address space is about to be
* destroyed.
*/
if (atomic_read(&mm->mm_users) == 0)
return;
fix_range_common(mm, start_addr, end_addr, force); fix_range_common(mm, start_addr, end_addr, force);
} }
...@@ -556,13 +570,6 @@ EXPORT_SYMBOL(flush_tlb_range); ...@@ -556,13 +570,6 @@ EXPORT_SYMBOL(flush_tlb_range);
void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
unsigned long end) unsigned long end)
{ {
/*
* Don't bother flushing if this address space is about to be
* destroyed.
*/
if (atomic_read(&mm->mm_users) == 0)
return;
fix_range(mm, start, end, 0); fix_range(mm, start, end, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment