• Joonwoo Park's avatar
    cpuset: handle race between CPU hotplug and cpuset_hotplug_work · e1df4c5d
    Joonwoo Park authored
    [ Upstream commit 28b89b9e ]
    
    A discrepancy between cpu_online_mask and cpuset's effective_cpus
    mask is inevitable during hotplug since cpuset defers updating of
    effective_cpus mask using a workqueue, during which time nothing
    prevents the system from more hotplug operations.  For that reason
    guarantee_online_cpus() walks up the cpuset hierarchy until it finds
    an intersection under the assumption that top cpuset's effective_cpus
    mask intersects with cpu_online_mask even with such a race occurring.
    
    However a sequence of CPU hotplugs can open a time window, during which
    none of the effective CPUs in the top cpuset intersect with
    cpu_online_mask.
    
    For example when there are 4 possible CPUs 0-3 and only CPU0 is online:
    
      ========================  ===========================
       cpu_online_mask           top_cpuset.effective_cpus
      ========================  ===========================
       echo 1 > cpu2/online.
       CP...
    e1df4c5d
cpuset.c 78.6 KB