summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2015-03-23 20:21:51 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2015-03-23 20:22:48 -0300
commit0a4e6be9ca17c54817cf814b4b5aa60478c6df27 (patch)
tree461ed6cace26da5c75d1c01982fde2f3ccc5d4fa /kernel/sched
parent58d2930f4ee335ab703d768cb0318331fc1bb62c (diff)
downloadop-kernel-dev-0a4e6be9ca17c54817cf814b4b5aa60478c6df27.zip
op-kernel-dev-0a4e6be9ca17c54817cf814b4b5aa60478c6df27.tar.gz
x86: kvm: Revert "remove sched notifier for cross-cpu migrations"
The following point: 2. per-CPU pvclock time info is updated if the underlying CPU changes. Is not true anymore since "KVM: x86: update pvclock area conditionally, on cpu migration". Add task migration notification back. Problem noticed by Andy Lutomirski. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> CC: stable@kernel.org # 3.11+
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f0f831e..d0c4209 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -996,6 +996,13 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
rq_clock_skip_update(rq, true);
}
+static ATOMIC_NOTIFIER_HEAD(task_migration_notifier);
+
+void register_task_migration_notifier(struct notifier_block *n)
+{
+ atomic_notifier_chain_register(&task_migration_notifier, n);
+}
+
#ifdef CONFIG_SMP
void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
{
@@ -1026,10 +1033,18 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
trace_sched_migrate_task(p, new_cpu);
if (task_cpu(p) != new_cpu) {
+ struct task_migration_notifier tmn;
+
if (p->sched_class->migrate_task_rq)
p->sched_class->migrate_task_rq(p, new_cpu);
p->se.nr_migrations++;
perf_sw_event_sched(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 0);
+
+ tmn.task = p;
+ tmn.from_cpu = task_cpu(p);
+ tmn.to_cpu = new_cpu;
+
+ atomic_notifier_call_chain(&task_migration_notifier, 0, &tmn);
}
__set_task_cpu(p, new_cpu);
OpenPOWER on IntegriCloud