[PATCH] Reduce TLB flushing during process migration

From: Martin Hicks
Date: Tue Feb 17 2004 - 10:51:54 EST



Hi Andrew,

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

CC'ed Rusty because this patch is applied on top of his cpuhotplug code.

This patch was generated against -rc4 with the rc3-mm1 patch merged on
top of it.

mh

--
Martin Hicks Wild Open Source Inc.
mort@xxxxxxxxxxxxxxxxxx 613-266-2296
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1680 -> 1.1681
# kernel/sched.c 1.240 -> 1.241
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/02/17 mort@xxxxxxxxxxxxxxxxxxxxx 1.1681
# Process migration optimization.
# --------------------------------------------
#
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);
+
return;
}
out: