diff options
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 89ba25b164db..74cb623bc0d3 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -323,8 +323,7 @@ static struct file_system_type cpuset_fs_type = { | |||
323 | /* | 323 | /* |
324 | * Return in pmask the portion of a cpusets's cpus_allowed that | 324 | * Return in pmask the portion of a cpusets's cpus_allowed that |
325 | * are online. If none are online, walk up the cpuset hierarchy | 325 | * are online. If none are online, walk up the cpuset hierarchy |
326 | * until we find one that does have some online cpus. The top | 326 | * until we find one that does have some online cpus. |
327 | * cpuset always has some cpus online. | ||
328 | * | 327 | * |
329 | * One way or another, we guarantee to return some non-empty subset | 328 | * One way or another, we guarantee to return some non-empty subset |
330 | * of cpu_online_mask. | 329 | * of cpu_online_mask. |
@@ -333,8 +332,20 @@ static struct file_system_type cpuset_fs_type = { | |||
333 | */ | 332 | */ |
334 | static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask) | 333 | static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask) |
335 | { | 334 | { |
336 | while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask)) | 335 | while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask)) { |
337 | cs = parent_cs(cs); | 336 | cs = parent_cs(cs); |
337 | if (unlikely(!cs)) { | ||
338 | /* | ||
339 | * The top cpuset doesn't have any online cpu as a | ||
340 | * consequence of a race between cpuset_hotplug_work | ||
341 | * and cpu hotplug notifier. But we know the top | ||
342 | * cpuset's effective_cpus is on its way to to be | ||
343 | * identical to cpu_online_mask. | ||
344 | */ | ||
345 | cpumask_copy(pmask, cpu_online_mask); | ||
346 | return; | ||
347 | } | ||
348 | } | ||
338 | cpumask_and(pmask, cs->effective_cpus, cpu_online_mask); | 349 | cpumask_and(pmask, cs->effective_cpus, cpu_online_mask); |
339 | } | 350 | } |
340 | 351 | ||