aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorPaul Turner <pjt@google.com>2012-10-04 07:18:30 -0400
committerIngo Molnar <mingo@kernel.org>2012-10-24 04:27:23 -0400
commit0a74bef8bed18dc6889e9bc37ea1050a50c86c89 (patch)
tree9d7b66a1b7ac0b05cd9b9b093cb6d89904db8f83 /kernel/sched
parent9ee474f55664ff63111c843099d365e7ecffb56f (diff)
sched: Add an rq migration call-back to sched_class
Since we are now doing bottom up load accumulation we need explicit notification when a task has been re-parented so that the old hierarchy can be updated. Adds: migrate_task_rq(struct task_struct *p, int next_cpu) (The alternative is to do this out of __set_task_cpu, but it was suggested that this would be a cleaner encapsulation.) Signed-off-by: Paul Turner <pjt@google.com> Reviewed-by: Ben Segall <bsegall@google.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20120823141506.660023400@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c2
-rw-r--r--kernel/sched/fair.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 00898f1fb69..f26860074ef 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -952,6 +952,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
952 trace_sched_migrate_task(p, new_cpu); 952 trace_sched_migrate_task(p, new_cpu);
953 953
954 if (task_cpu(p) != new_cpu) { 954 if (task_cpu(p) != new_cpu) {
955 if (p->sched_class->migrate_task_rq)
956 p->sched_class->migrate_task_rq(p, new_cpu);
955 p->se.nr_migrations++; 957 p->se.nr_migrations++;
956 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0); 958 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0);
957 } 959 }
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 83194175e84..5e602e6ba0c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3047,6 +3047,17 @@ unlock:
3047 3047
3048 return new_cpu; 3048 return new_cpu;
3049} 3049}
3050
3051/*
3052 * Called immediately before a task is migrated to a new cpu; task_cpu(p) and
3053 * cfs_rq_of(p) references at time of call are still valid and identify the
3054 * previous cpu. However, the caller only guarantees p->pi_lock is held; no
3055 * other assumptions, including the state of rq->lock, should be made.
3056 */
3057static void
3058migrate_task_rq_fair(struct task_struct *p, int next_cpu)
3059{
3060}
3050#endif /* CONFIG_SMP */ 3061#endif /* CONFIG_SMP */
3051 3062
3052static unsigned long 3063static unsigned long
@@ -5607,6 +5618,7 @@ const struct sched_class fair_sched_class = {
5607 5618
5608#ifdef CONFIG_SMP 5619#ifdef CONFIG_SMP
5609 .select_task_rq = select_task_rq_fair, 5620 .select_task_rq = select_task_rq_fair,
5621 .migrate_task_rq = migrate_task_rq_fair,
5610 5622
5611 .rq_online = rq_online_fair, 5623 .rq_online = rq_online_fair,
5612 .rq_offline = rq_offline_fair, 5624 .rq_offline = rq_offline_fair,