Linux NUMA userland tools development
 help / color / mirror / Atom feed
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: linux-numa@vger.kernel.org
Cc: akpm@linux-foundation.org, Mel Gorman <mel@csn.ul.ie>,
	cl@linux-foundation.org, Nick Piggin <npiggin@kernel.dk>,
	Hugh Dickins <hughd@google.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	andi@firstfloor.org, David Rientjes <rientjes@google.com>,
	Avi Kivity <avi@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: [PATCH/RFC 6/11] numa - Automatic-migration - hook to scheduler inter-node migration
Date: Thu, 11 Nov 2010 15:01:51 -0500	[thread overview]
Message-ID: <20101111200151.12641.75621.sendpatchset@zaphod.localdomain> (raw)
In-Reply-To: <20101111200103.12641.80303.sendpatchset@zaphod.localdomain>

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@hp.com>

 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();

  parent reply	other threads:[~2010-11-11 20:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 20:01 [PATCH/RFC 0/11] numa - Automatic-migration Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 1/11] numa - Automatic-migration - preparation, cleanup Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 2/11] numa - Automatic-migration - per cpuset automigration control Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 3/11] numa - Automatic-migration - check notify migrate pending Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 4/11] numa - Automatic-migration - ia64 " Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 5/11] numa - Automatic-migration - x86_64 " Lee Schermerhorn
2010-11-11 20:01 ` Lee Schermerhorn [this message]
2010-11-11 20:01 ` [PATCH/RFC 7/11] numa - Automatic-migration - add internode migration delay Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 8/11] numa - Automatic-migration - per cpuset max mapcount control Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 9/11] numa - Automatic-migration - hook to migrate on fault Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 10/11] numa - Automatic-migration - per proc automigrate kick control Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 11/11] numa - Automatic-migration - add statistics Lee Schermerhorn
2010-11-14  6:42 ` [PATCH/RFC 0/11] numa - Automatic-migration KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101111200151.12641.75621.sendpatchset@zaphod.localdomain \
    --to=lee.schermerhorn@hp.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=cl@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-numa@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=npiggin@kernel.dk \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox