[tip:sched/core] sched: Ensure the migration task doesn't go away during use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  693525e3bea25cf2ee6cf2b862ba7c148e891df2
Gitweb:     http://git.kernel.org/tip/693525e3bea25cf2ee6cf2b862ba7c148e891df2
Author:     Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
AuthorDate: Tue, 21 Jul 2009 13:56:38 +0200
Committer:  Ingo Molnar <mingo@xxxxxxx>
CommitDate: Sun, 2 Aug 2009 14:26:15 +0200

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@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
 kernel/sched.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 475138c..7f83be3 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)
 
 	if (migrate_task(p, cpumask_any_and(cpu_online_mask, new_mask), &req)) {
 		/* Need help from migration thread: drop lock and wait. */
+		struct task_struct *mt = rq->migration_thread;
+
+		get_task_struct(mt);
 		task_rq_unlock(rq, &flags);
 		wake_up_process(rq->migration_thread);
+		put_task_struct(mt);
 		wait_for_completion(&req.done);
 		tlb_migrate_finish(p->mm);
 		return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux