Skip to content

cgroup/cpuset: Speed up v2 mask updates and domain rebuilds

Chuyi Zhou lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3cgroup/cpuset: Skip the sched domain attribute allocation on v2kernel/cgroup/cpuset.c+7 -140 replies
2/3cgroup/cpuset: Check v2 partition overlap in a single passkernel/cgroup/cpuset-internal.h kernel/cgroup/cpuset.c+21 -210 replies
3/3cgroup/cpuset: Skip sibling checks for v2 members without exclusive CPUskernel/cgroup/cpuset.c+11 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] cgroup/cpuset: Speed up v2 mask updates and domain rebuilds

We run high-density container workloads on large bare-metal hosts using cgroup v2. We may configure many root partitions on a single host.

Changing a member's cpuset.cpus scans its siblings under cpuset_mutex, so the cost of a write grows with the number of children under the same parent. Creating or resizing a root partition can trigger a scheduling domain rebuild. The rebuild checks every pair of partition CPU masks for overlap, so the number of checks grows quadratically with the number of partitions.

This series speeds up cpuset.cpus updates and scheduling domain rebuilds on these hosts. The timings below are from a dual-socket Xeon Platinum 8582C with 240 online CPUs.

1. All v2 partitions use the default scheduling domain attributes. Passing NULL saves one array allocation per rebuild and one attribute initialization per partition.

2. Check each partition's effective CPUs against the union of the masks already seen to detect overlap in a single pass. With 128 root partitions, median time in generate_sched_domains() fell from 42.9 us to 3.14 us.

3. Skip the sibling scan when a member's cpuset.cpus.exclusive stays empty. With 2,048 children under one parent and one sleeping task in the target cpuset, median write latency for cpuset.cpus fell from 24.1 us to 0.85 us.

Thanks,
Chuyi

Chuyi Zhou (3):
cgroup/cpuset: Skip the sched domain attribute allocation on v2 cgroup/cpuset: Check v2 partition overlap in a single pass cgroup/cpuset: Skip sibling checks for v2 members without exclusive
CPUs

 kernel/cgroup/cpuset-internal.h |  1 -
 kernel/cgroup/cpuset.c          | 74 +++++++++++++++++----------------
 2 files changed, 39 insertions(+), 36 deletions(-)

base-commit: a6ca40399708c4322e87448f6c47da7192d72895

Signature · 1 line
2.20.1