diff options
-rw-r--r-- | kernel/sched/core.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 34cb8805c55d..3199e233222b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3135,6 +3135,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) { unsigned long flags; int cpu, src_cpu, success = 0; + int notify = 0; + struct migration_notify_data mnd; #ifdef CONFIG_SMP struct rq *rq; u64 wallclock; @@ -3232,12 +3234,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) ttwu_queue(p, cpu); stat: ttwu_stat(p, cpu, wake_flags); -out: - raw_spin_unlock_irqrestore(&p->pi_lock, flags); if (task_notify_on_migrate(p)) { - struct migration_notify_data mnd; - mnd.src_cpu = src_cpu; mnd.dest_cpu = cpu; mnd.load = pct_task_load(p); @@ -3251,10 +3249,16 @@ out: */ if ((src_cpu != cpu) || (mnd.load > sysctl_sched_wakeup_load_threshold)) - atomic_notifier_call_chain(&migration_notifier_head, - 0, (void *)&mnd); + notify = 1; } +out: + raw_spin_unlock_irqrestore(&p->pi_lock, flags); + + if (notify) + atomic_notifier_call_chain(&migration_notifier_head, + 0, (void *)&mnd); + return success; } |