Re: [PATCH] Reduce TLB flushing during process migration

From: Manfred Spraul
Date: Tue Feb 17 2004 - 11:24:07 EST


Martin wrote:

diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c Tue Feb 17 07:33:59 2004
+++ b/kernel/sched.c Tue Feb 17 07:33:59 2004
@@ -25,6 +25,7 @@
#include <linux/highmem.h>
#include <linux/smp_lock.h>
#include <asm/mmu_context.h>
+#include <asm/tlbflush.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/kernel_stat.h>
@@ -1135,6 +1136,14 @@
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.
+ */
+ flush_tlb_mm(current->mm);
+


I think flush_tlb_mm() is the wrong function - e.g. for i386, it's a wasted flush, because i386 disconnects previous cpus from the tlb flush automatically.
And it's always the wrong thing if you've migrated one thread of a task that runs on multiple cpus. I think you need a new hook.

--
Manfred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/