]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Reduce TLB flushing during process migration
authorAndrew Morton <akpm@osdl.org>
Mon, 10 May 2004 06:25:57 +0000 (23:25 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 10 May 2004 06:25:57 +0000 (23:25 -0700)
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.

include/asm-generic/tlb.h
include/asm-ia64/tlb.h
kernel/sched.c

index 1358c5136889e66a892b244dc3534e27b2c1098f..69c11ff2e984b6e10daa25962e840a04ec00beb8 100644 (file)
@@ -146,4 +146,6 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
                __pmd_free_tlb(tlb, pmdp);                      \
        } while (0)
 
+#define tlb_migrate_prepare(mm) do { } while(0)
+
 #endif /* _ASM_GENERIC__TLB_H */
index 5d714b2061ed6b14d39bc8cc475d43df4859bcdd..ee0b0b3c76629f66b41d30f3fe1566a3881e917e 100644 (file)
@@ -211,6 +211,8 @@ __tlb_remove_tlb_entry (struct mmu_gather *tlb, pte_t *ptep, unsigned long addre
        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_end_vma(tlb, vma)                  do { } while (0)
 
index 025f04bfdf5ce2e8c4d57192598a69f95f99cabf..94e19f1a55801097fbdbf309647a833d94d20426 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/highmem.h>
 #include <linux/smp_lock.h>
 #include <asm/mmu_context.h>
+#include <linux//pagemap.h>
+#include <asm/tlb.h>
 #include <linux/interrupt.h>
 #include <linux/completion.h>
 #include <linux/kernel_stat.h>
@@ -1127,6 +1129,14 @@ static void sched_migrate_task(task_t *p, int dest_cpu)
                task_rq_unlock(rq, &flags);
                wake_up_process(rq->migration_thread);
                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;
        }
 out: