AutoPage Migration - hook sched migrate to memory migration Add check for internode migration to scheduler -- in most places where a new cpu is assigned via set_task_cpu(). If MIGRATION is configured, and auto-migration is enabled [and this is a user space task], the check will set "migration pending" for the task IFF the destination cpu is on a different node from the last cpu to which the task was assigned. Migration of affected pages [those with default policy] will occur when the task returns to user space. Signed-off-by: Lee Schermerhorn <lee.schermerhorn@xxxxxx> kernel/sched.c | 7 ++++++- kernel/sched_fair.c | 2 ++ kernel/sched_rt.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) Index: linux-2.6.36-mmotm-101103-1217/kernel/sched.c =================================================================== --- linux-2.6.36-mmotm-101103-1217.orig/kernel/sched.c +++ linux-2.6.36-mmotm-101103-1217/kernel/sched.c @@ -72,6 +72,7 @@ #include <linux/ctype.h> #include <linux/ftrace.h> #include <linux/slab.h> +#include <linux/auto-migrate.h> #include <asm/tlb.h> #include <asm/irq_regs.h> @@ -2519,8 +2520,10 @@ static int try_to_wake_up(struct task_st } cpu = select_task_rq(rq, p, SD_BALANCE_WAKE, wake_flags); - if (cpu != orig_cpu) + if (cpu != orig_cpu) { + check_internode_migration(p, cpu); set_task_cpu(p, cpu); + } __task_rq_unlock(rq); rq = cpu_rq(cpu); @@ -2699,6 +2702,7 @@ void sched_fork(struct task_struct *p, i * Silence PROVE_RCU. */ rcu_read_lock(); + check_internode_migration(p, cpu); /* TODO: here? */ set_task_cpu(p, cpu); rcu_read_unlock(); @@ -5681,6 +5685,7 @@ static int __migrate_task(struct task_st */ if (p->se.on_rq) { deactivate_task(rq_src, p, 0); + check_internode_migration(p, dest_cpu); set_task_cpu(p, dest_cpu); activate_task(rq_dest, p, 0); check_preempt_curr(rq_dest, p, 0); Index: linux-2.6.36-mmotm-101103-1217/kernel/sched_rt.c =================================================================== --- linux-2.6.36-mmotm-101103-1217.orig/kernel/sched_rt.c +++ linux-2.6.36-mmotm-101103-1217/kernel/sched_rt.c @@ -1372,6 +1372,7 @@ retry: } deactivate_task(rq, next_task, 0); + check_internode_migration(next_task, lowest_rq->cpu); set_task_cpu(next_task, lowest_rq->cpu); activate_task(lowest_rq, next_task, 0); @@ -1455,6 +1456,7 @@ static int pull_rt_task(struct rq *this_ ret = 1; deactivate_task(src_rq, p, 0); + check_internode_migration(p, this_cpu); set_task_cpu(p, this_cpu); activate_task(this_rq, p, 0); /* Index: linux-2.6.36-mmotm-101103-1217/kernel/sched_fair.c =================================================================== --- linux-2.6.36-mmotm-101103-1217.orig/kernel/sched_fair.c +++ linux-2.6.36-mmotm-101103-1217/kernel/sched_fair.c @@ -1761,6 +1761,7 @@ static void pull_task(struct rq *src_rq, struct rq *this_rq, int this_cpu) { deactivate_task(src_rq, p, 0); + check_internode_migration(p, this_cpu); set_task_cpu(p, this_cpu); activate_task(this_rq, p, 0); check_preempt_curr(this_rq, p, 0); @@ -3794,6 +3795,7 @@ static void task_fork_fair(struct task_s update_rq_clock(rq); if (unlikely(task_cpu(p) != this_cpu)) { + check_internode_migration(p, this_cpu); /* TODO: here? */ rcu_read_lock(); __set_task_cpu(p, this_cpu); rcu_read_unlock(); -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html