aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2008-06-05 15:57:11 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-10 06:26:16 -0400
commit9985b0bab332289f14837eff3c6e0bcc658b58f7 (patch)
tree8c4bcbc4348c473b14644dc4d371a45c0dabda53 /kernel/sched.c
parent7def2be1dc679984f4c4fb3ef19a8a081b2454ec (diff)
sched: prevent bound kthreads from changing cpus_allowed
Kthreads that have called kthread_bind() are bound to specific cpus, so other tasks should not be able to change their cpus_allowed from under them. Otherwise, it is possible to move kthreads, such as the migration or software watchdog threads, so they are not allowed access to the cpu they work on. Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Menage <menage@google.com> Cc: Paul Jackson <pj@sgi.com> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index e9c24a128655..164fe7fe0d89 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5563,6 +5563,12 @@ int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask)
5563 goto out; 5563 goto out;
5564 } 5564 }
5565 5565
5566 if (unlikely((p->flags & PF_THREAD_BOUND) && p != current &&
5567 !cpus_equal(p->cpus_allowed, *new_mask))) {
5568 ret = -EINVAL;
5569 goto out;
5570 }
5571
5566 if (p->sched_class->set_cpus_allowed) 5572 if (p->sched_class->set_cpus_allowed)
5567 p->sched_class->set_cpus_allowed(p, new_mask); 5573 p->sched_class->set_cpus_allowed(p, new_mask);
5568 else { 5574 else {