diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-07-21 07:56:38 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-02 08:26:15 -0400 |
commit | 693525e3bea25cf2ee6cf2b862ba7c148e891df2 (patch) | |
tree | 7bb3ba6262c1adad1ffb8a52df9ff0924caec76a /kernel/sched.c | |
parent | 8f48894fcc89ddec62e1762f73a0825793e59e91 (diff) |
sched: Ensure the migration task doesn't go away during use
Like sched_migrate_task(), set_cpus_allowed_ptr() should hold
onto the migration thread too.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 475138c42548..7f83be35d65c 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7078,8 +7078,12 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) | |||
7078 | 7078 | ||
7079 | if (migrate_task(p, cpumask_any_and(cpu_online_mask, new_mask), &req)) { | 7079 | if (migrate_task(p, cpumask_any_and(cpu_online_mask, new_mask), &req)) { |
7080 | /* Need help from migration thread: drop lock and wait. */ | 7080 | /* Need help from migration thread: drop lock and wait. */ |
7081 | struct task_struct *mt = rq->migration_thread; | ||
7082 | |||
7083 | get_task_struct(mt); | ||
7081 | task_rq_unlock(rq, &flags); | 7084 | task_rq_unlock(rq, &flags); |
7082 | wake_up_process(rq->migration_thread); | 7085 | wake_up_process(rq->migration_thread); |
7086 | put_task_struct(mt); | ||
7083 | wait_for_completion(&req.done); | 7087 | wait_for_completion(&req.done); |
7084 | tlb_migrate_finish(p->mm); | 7088 | tlb_migrate_finish(p->mm); |
7085 | return 0; | 7089 | return 0; |