aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
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 6090d18b58a9..b84354f4de36 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1190,6 +1190,15 @@ static int cpuset_can_attach(struct cgroup_subsys *ss,
1190 1190
1191 if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) 1191 if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
1192 return -ENOSPC; 1192 return -ENOSPC;
1193 if (tsk->flags & PF_THREAD_BOUND) {
1194 cpumask_t mask;
1195
1196 mutex_lock(&callback_mutex);
1197 mask = cs->cpus_allowed;
1198 mutex_unlock(&callback_mutex);
1199 if (!cpus_equal(tsk->cpus_allowed, mask))
1200 return -EINVAL;
1201 }
1193 1202
1194 return security_task_setscheduler(tsk, 0, NULL); 1203 return security_task_setscheduler(tsk, 0, NULL);
1195} 1204}
@@ -1203,11 +1212,14 @@ static void cpuset_attach(struct cgroup_subsys *ss,
1203 struct mm_struct *mm; 1212 struct mm_struct *mm;
1204 struct cpuset *cs = cgroup_cs(cont); 1213 struct cpuset *cs = cgroup_cs(cont);
1205 struct cpuset *oldcs = cgroup_cs(oldcont); 1214 struct cpuset *oldcs = cgroup_cs(oldcont);
1215 int err;
1206 1216
1207 mutex_lock(&callback_mutex); 1217 mutex_lock(&callback_mutex);
1208 guarantee_online_cpus(cs, &cpus); 1218 guarantee_online_cpus(cs, &cpus);
1209 set_cpus_allowed_ptr(tsk, &cpus); 1219 err = set_cpus_allowed_ptr(tsk, &cpus);
1210 mutex_unlock(&callback_mutex); 1220 mutex_unlock(&callback_mutex);
1221 if (err)
1222 return;
1211 1223
1212 from = oldcs->mems_allowed; 1224 from = oldcs->mems_allowed;
1213 to = cs->mems_allowed; 1225 to = cs->mems_allowed;