Commit fa8f2c50 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Reduce TLB flushing during process migration

From: Martin Hicks <mort@wildopensource.com>

Another optimization patch from Jack Steiner, intended to reduce TLB
flushes during process migration.

Most architextures should define tlb_migrate_prepare() to be flush_tlb_mm(),
but on i386, it would be a wasted flush, because i386 disconnects previous
cpus from the tlb flush automatically.
parent 1ec43096
...@@ -146,4 +146,6 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) ...@@ -146,4 +146,6 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
__pmd_free_tlb(tlb, pmdp); \ __pmd_free_tlb(tlb, pmdp); \
} while (0) } while (0)
#define tlb_migrate_prepare(mm) do { } while(0)
#endif /* _ASM_GENERIC__TLB_H */ #endif /* _ASM_GENERIC__TLB_H */
...@@ -211,6 +211,8 @@ __tlb_remove_tlb_entry (struct mmu_gather *tlb, pte_t *ptep, unsigned long addre ...@@ -211,6 +211,8 @@ __tlb_remove_tlb_entry (struct mmu_gather *tlb, pte_t *ptep, unsigned long addre
tlb->end_addr = address + PAGE_SIZE; tlb->end_addr = address + PAGE_SIZE;
} }
#define tlb_migrate_prepare(mm) flush_tlb_mm(mm)
#define tlb_start_vma(tlb, vma) do { } while (0) #define tlb_start_vma(tlb, vma) do { } while (0)
#define tlb_end_vma(tlb, vma) do { } while (0) #define tlb_end_vma(tlb, vma) do { } while (0)
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <linux//pagemap.h>
#include <asm/tlb.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
...@@ -1127,6 +1129,14 @@ static void sched_migrate_task(task_t *p, int dest_cpu) ...@@ -1127,6 +1129,14 @@ static void sched_migrate_task(task_t *p, int dest_cpu)
task_rq_unlock(rq, &flags); task_rq_unlock(rq, &flags);
wake_up_process(rq->migration_thread); wake_up_process(rq->migration_thread);
wait_for_completion(&req.done); wait_for_completion(&req.done);
/*
* we want a new context here. This eliminates TLB
* flushes on the cpus where the process executed prior to
* the migration.
*/
tlb_migrate_prepare(current->mm);
return; return;
} }
out: out:
......
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