diff options
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6271b89f87ac..0533496b6228 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -923,6 +923,13 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags) | |||
923 | rq->skip_clock_update = 1; | 923 | rq->skip_clock_update = 1; |
924 | } | 924 | } |
925 | 925 | ||
926 | static ATOMIC_NOTIFIER_HEAD(task_migration_notifier); | ||
927 | |||
928 | void register_task_migration_notifier(struct notifier_block *n) | ||
929 | { | ||
930 | atomic_notifier_chain_register(&task_migration_notifier, n); | ||
931 | } | ||
932 | |||
926 | #ifdef CONFIG_SMP | 933 | #ifdef CONFIG_SMP |
927 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | 934 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) |
928 | { | 935 | { |
@@ -953,10 +960,18 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | |||
953 | trace_sched_migrate_task(p, new_cpu); | 960 | trace_sched_migrate_task(p, new_cpu); |
954 | 961 | ||
955 | if (task_cpu(p) != new_cpu) { | 962 | if (task_cpu(p) != new_cpu) { |
963 | struct task_migration_notifier tmn; | ||
964 | |||
956 | if (p->sched_class->migrate_task_rq) | 965 | if (p->sched_class->migrate_task_rq) |
957 | p->sched_class->migrate_task_rq(p, new_cpu); | 966 | p->sched_class->migrate_task_rq(p, new_cpu); |
958 | p->se.nr_migrations++; | 967 | p->se.nr_migrations++; |
959 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0); | 968 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0); |
969 | |||
970 | tmn.task = p; | ||
971 | tmn.from_cpu = task_cpu(p); | ||
972 | tmn.to_cpu = new_cpu; | ||
973 | |||
974 | atomic_notifier_call_chain(&task_migration_notifier, 0, &tmn); | ||
960 | } | 975 | } |
961 | 976 | ||
962 | __set_task_cpu(p, new_cpu); | 977 | __set_task_cpu(p, new_cpu); |