summaryrefslogtreecommitdiff
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-14 14:11:02 (GMT)
committerIngo Molnar <mingo@elte.hu>2008-07-14 14:11:02 (GMT)
commitd14c8a680ccfdeb5e7b9be4d61162c2b373bd1e8 (patch)
tree38cead29b9b34b9d26b5cfe7b2c2673d6f7ac052 /kernel/cpuset.c
parentd59fdcf2ac501de99c3dfb452af5e254d4342886 (diff)
parent873a6ed6288b6c2c0d2cc84d3b2bf2fab9ba0181 (diff)
downloadlinux-fsl-qoriq-d14c8a680ccfdeb5e7b9be4d61162c2b373bd1e8.tar.xz
Merge branch 'sched/for-linus' into tracing/for-linus
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 798b3ab..459d601 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1194,6 +1194,15 @@ static int cpuset_can_attach(struct cgroup_subsys *ss,
if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
return -ENOSPC;
+ if (tsk->flags & PF_THREAD_BOUND) {
+ cpumask_t mask;
+
+ mutex_lock(&callback_mutex);
+ mask = cs->cpus_allowed;
+ mutex_unlock(&callback_mutex);
+ if (!cpus_equal(tsk->cpus_allowed, mask))
+ return -EINVAL;
+ }
return security_task_setscheduler(tsk, 0, NULL);
}
@@ -1207,11 +1216,14 @@ static void cpuset_attach(struct cgroup_subsys *ss,
struct mm_struct *mm;
struct cpuset *cs = cgroup_cs(cont);
struct cpuset *oldcs = cgroup_cs(oldcont);
+ int err;
mutex_lock(&callback_mutex);
guarantee_online_cpus(cs, &cpus);
- set_cpus_allowed_ptr(tsk, &cpus);
+ err = set_cpus_allowed_ptr(tsk, &cpus);
mutex_unlock(&callback_mutex);
+ if (err)
+ return;
from = oldcs->mems_allowed;
to = cs->mems_allowed;