diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 41c2343df975..afa29cfc5bbb 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1311,20 +1311,19 @@ static int cpuset_can_attach(struct cgroup_subsys *ss, | |||
1311 | struct cgroup *cont, struct task_struct *tsk) | 1311 | struct cgroup *cont, struct task_struct *tsk) |
1312 | { | 1312 | { |
1313 | struct cpuset *cs = cgroup_cs(cont); | 1313 | struct cpuset *cs = cgroup_cs(cont); |
1314 | int ret = 0; | ||
1314 | 1315 | ||
1315 | if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) | 1316 | if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) |
1316 | return -ENOSPC; | 1317 | return -ENOSPC; |
1317 | if (tsk->flags & PF_THREAD_BOUND) { | ||
1318 | cpumask_t mask; | ||
1319 | 1318 | ||
1319 | if (tsk->flags & PF_THREAD_BOUND) { | ||
1320 | mutex_lock(&callback_mutex); | 1320 | mutex_lock(&callback_mutex); |
1321 | mask = cs->cpus_allowed; | 1321 | if (!cpus_equal(tsk->cpus_allowed, cs->cpus_allowed)) |
1322 | ret = -EINVAL; | ||
1322 | mutex_unlock(&callback_mutex); | 1323 | mutex_unlock(&callback_mutex); |
1323 | if (!cpus_equal(tsk->cpus_allowed, mask)) | ||
1324 | return -EINVAL; | ||
1325 | } | 1324 | } |
1326 | 1325 | ||
1327 | return security_task_setscheduler(tsk, 0, NULL); | 1326 | return ret < 0 ? ret : security_task_setscheduler(tsk, 0, NULL); |
1328 | } | 1327 | } |
1329 | 1328 | ||
1330 | static void cpuset_attach(struct cgroup_subsys *ss, | 1329 | static void cpuset_attach(struct cgroup_subsys *ss, |