mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chuyi Zhou" <zhouchuyi@bytedance.com>
To: <longman@redhat.com>, <tj@kernel.org>, <hannes@cmpxchg.org>,
	 <mkoutny@suse.com>, <ridong.chen@linux.dev>
Cc: <linux-kernel@vger.kernel.org>, "Chuyi Zhou" <zhouchuyi@bytedance.com>
Subject: [PATCH 0/3] cgroup/cpuset: Speed up v2 mask updates and domain rebuilds
Date: Mon, 23 Nov 2026 20:45:21 +0800	[thread overview]
Message-ID: <cover.1795436486.git.zhouchuyi@bytedance.com> (raw)

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
-- 
2.20.1

             reply	other threads:[~2026-11-23 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 12:45 Chuyi Zhou [this message]
2026-11-23 12:45 ` [PATCH 1/3] cgroup/cpuset: Skip the sched domain attribute allocation on v2 Chuyi Zhou
2026-11-23 12:45 ` [PATCH 2/3] cgroup/cpuset: Check v2 partition overlap in a single pass Chuyi Zhou
2026-11-23 12:45 ` [PATCH 3/3] cgroup/cpuset: Skip sibling checks for v2 members without exclusive CPUs Chuyi Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1795436486.git.zhouchuyi@bytedance.com \
    --to=zhouchuyi@bytedance.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=ridong.chen@linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®