• Waiman Long's avatar
    cgroup/cpuset: Fix remote root partition creation problem · ccac8e8d
    Waiman Long authored
    Since commit 181c8e09 ("cgroup/cpuset: Introduce remote partition"),
    a remote partition can be created underneath a non-partition root cpuset
    as long as its exclusive_cpus are set to distribute exclusive CPUs down
    to its children. The generate_sched_domains() function, however, doesn't
    take into account this new behavior and hence will fail to create the
    sched domain needed for a remote root (non-isolated) partition.
    
    There are two issues related to remote partition support. First of
    all, generate_sched_domains() has a fast path that is activated if
    root_load_balance is true and top_cpuset.nr_subparts is non-zero. The
    later condition isn't quite correct for remote partitions as nr_subparts
    just shows the number of local child partitions underneath it. There
    can be no local child partition under top_cpuset even if there are
    remote partitions further down the hierarchy. Fix that by checking
    for subpartitions_cpus which contains exclusive CPUs allocated to both
    local and remote partitions.
    
    Secondly, the valid partition check for subtree skipping in the csa[]
    generation loop isn't enough as remote partition does not need to
    have a partition root parent. Fix this problem by breaking csa[] array
    generation loop of generate_sched_domains() into v1 and v2 specific parts
    and checking a cpuset's exclusive_cpus before skipping its subtree in
    the v2 case.
    
    Also simplify generate_sched_domains() for cgroup v2 as only
    non-isolating partition roots should be included in building the cpuset
    array and none of the v1 scheduling attributes other than a different
    way to create an isolated partition are supported.
    
    Fixes: 181c8e09 ("cgroup/cpuset: Introduce remote partition")
    Signed-off-by: default avatarWaiman Long <longman@redhat.com>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    ccac8e8d
cpuset.c 141 KB