Merge "cpuset: handle race between CPU hotplug and cpuset_hotplug_work"
This commit is contained in:
commit
646ce8a905
1 changed files with 14 additions and 3 deletions
|
@ -326,8 +326,7 @@ static struct file_system_type cpuset_fs_type = {
|
||||||
/*
|
/*
|
||||||
* Return in pmask the portion of a cpusets's cpus_allowed that
|
* Return in pmask the portion of a cpusets's cpus_allowed that
|
||||||
* are online. If none are online, walk up the cpuset hierarchy
|
* are online. If none are online, walk up the cpuset hierarchy
|
||||||
* until we find one that does have some online cpus. The top
|
* until we find one that does have some online cpus.
|
||||||
* cpuset always has some cpus online.
|
|
||||||
*
|
*
|
||||||
* One way or another, we guarantee to return some non-empty subset
|
* One way or another, we guarantee to return some non-empty subset
|
||||||
* of cpu_online_mask.
|
* of cpu_online_mask.
|
||||||
|
@ -336,8 +335,20 @@ static struct file_system_type cpuset_fs_type = {
|
||||||
*/
|
*/
|
||||||
static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask)
|
static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask)
|
||||||
{
|
{
|
||||||
while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask))
|
while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask)) {
|
||||||
cs = parent_cs(cs);
|
cs = parent_cs(cs);
|
||||||
|
if (unlikely(!cs)) {
|
||||||
|
/*
|
||||||
|
* The top cpuset doesn't have any online cpu as a
|
||||||
|
* consequence of a race between cpuset_hotplug_work
|
||||||
|
* and cpu hotplug notifier. But we know the top
|
||||||
|
* cpuset's effective_cpus is on its way to to be
|
||||||
|
* identical to cpu_online_mask.
|
||||||
|
*/
|
||||||
|
cpumask_copy(pmask, cpu_online_mask);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
cpumask_and(pmask, cs->effective_cpus, cpu_online_mask);
|
cpumask_and(pmask, cs->effective_cpus, cpu_online_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue