aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f0c884a0e574..d753837cca33 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -304,53 +304,38 @@ static struct file_system_type cpuset_fs_type = {
304/* 304/*
305 * Return in pmask the portion of a cpusets's cpus_allowed that 305 * Return in pmask the portion of a cpusets's cpus_allowed that
306 * are online. If none are online, walk up the cpuset hierarchy 306 * are online. If none are online, walk up the cpuset hierarchy
307 * until we find one that does have some online cpus. If we get 307 * until we find one that does have some online cpus. The top
308 * all the way to the top and still haven't found any online cpus, 308 * cpuset always has some cpus online.
309 * return cpu_online_mask. Or if passed a NULL cs from an exit'ing
310 * task, return cpu_online_mask.
311 * 309 *
312 * One way or another, we guarantee to return some non-empty subset 310 * One way or another, we guarantee to return some non-empty subset
313 * of cpu_online_mask. 311 * of cpu_online_mask.
314 * 312 *
315 * Call with callback_mutex held. 313 * Call with callback_mutex held.
316 */ 314 */
317
318static void guarantee_online_cpus(const struct cpuset *cs, 315static void guarantee_online_cpus(const struct cpuset *cs,
319 struct cpumask *pmask) 316 struct cpumask *pmask)
320{ 317{
321 while (cs && !cpumask_intersects(cs->cpus_allowed, cpu_online_mask)) 318 while (!cpumask_intersects(cs->cpus_allowed, cpu_online_mask))
322 cs = parent_cs(cs); 319 cs = parent_cs(cs);
323 if (cs) 320 cpumask_and(pmask, cs->cpus_allowed, cpu_online_mask);
324 cpumask_and(pmask, cs->cpus_allowed, cpu_online_mask);
325 else
326 cpumask_copy(pmask, cpu_online_mask);
327 BUG_ON(!cpumask_intersects(pmask, cpu_online_mask));
328} 321}
329 322
330/* 323/*
331 * Return in *pmask the portion of a cpusets's mems_allowed that 324 * Return in *pmask the portion of a cpusets's mems_allowed that
332 * are online, with memory. If none are online with memory, walk 325 * are online, with memory. If none are online with memory, walk
333 * up the cpuset hierarchy until we find one that does have some 326 * up the cpuset hierarchy until we find one that does have some
334 * online mems. If we get all the way to the top and still haven't 327 * online mems. The top cpuset always has some mems online.
335 * found any online mems, return node_states[N_MEMORY].
336 * 328 *
337 * One way or another, we guarantee to return some non-empty subset 329 * One way or another, we guarantee to return some non-empty subset
338 * of node_states[N_MEMORY]. 330 * of node_states[N_MEMORY].
339 * 331 *
340 * Call with callback_mutex held. 332 * Call with callback_mutex held.
341 */ 333 */
342
343static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask) 334static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask)
344{ 335{
345 while (cs && !nodes_intersects(cs->mems_allowed, 336 while (!nodes_intersects(cs->mems_allowed, node_states[N_MEMORY]))
346 node_states[N_MEMORY]))
347 cs = parent_cs(cs); 337 cs = parent_cs(cs);
348 if (cs) 338 nodes_and(*pmask, cs->mems_allowed, node_states[N_MEMORY]);
349 nodes_and(*pmask, cs->mems_allowed,
350 node_states[N_MEMORY]);
351 else
352 *pmask = node_states[N_MEMORY];
353 BUG_ON(!nodes_intersects(*pmask, node_states[N_MEMORY]));
354} 339}
355 340
356/* 341/*