mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qiliang Yuan <qiliang.yuan@linux.dev>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Qiliang Yuan <qiliang.yuan@linux.dev>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/fair: Avoid re-syncing runtime_enabled on root domain changes
Date: Thu, 12 Nov 2026 06:10:55 -0500	[thread overview]
Message-ID: <20261112111055.400697-1-qiliang.yuan@linux.dev> (raw)
In-Reply-To: <20261112105624.GM2668804@noisy.programming.kicks-ass.net>

On Thu, Nov 12, 2026 at 11:56:24AM +0100, Peter Zijlstra wrote:
> How do you end up with 4k cgroups ?!? That's wild.

It is common on hosts running AI agent harnesses: every agent sandbox
gets its own container, and each pod and container has a cgroup with
the cpu controller enabled, so a single kernel easily carries over a
thousand task groups. 4000 is the upper end of that, picked to show the
scaling.

> Also, why do you care about the rebuild performance? I'm not entirely
> sure it makes sense to add data for something that 'never' happens. Do
> we really need a new member variable for this?

On those setups it is not rare. Agent harnesses and KubeVirt both
hot-add and remove vCPUs at run time to follow the load, and every
hotplug rebuilds the sched domains of the guest.

A rebuild runs rq_attach_root() on every active CPU, and with the rq
lock held and interrupts disabled it walks all task groups twice. With
4000 cpu cgroups on a 32-CPU VM, one rq_attach_root() call takes 188 us
at the median and up to 938 us, against 2 us with both patches applied
(20 partition switches, 1280 calls). So every rebuild leaves each CPU
with interrupts off for close to a millisecond in the worst case.

The member is there because rq_online_fair() can't tell a rebuild from
a CPU coming up: the CPU is active in both cases, but only the latter
can have runtime_enabled out of date after unthrottle_offline_cfs_rqs().

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  1:24 [PATCH 0/2] sched/fair: Cut per-group work from sched domain rebuilds Qiliang Yuan
2026-11-12  1:24 ` [PATCH 1/2] sched/fair: Skip rq_offline_fair() work for CPUs that stay active Qiliang Yuan
2026-11-12  1:24 ` [PATCH 2/2] sched/fair: Avoid re-syncing runtime_enabled on root domain changes Qiliang Yuan
2026-11-12 10:56   ` Peter Zijlstra
2026-11-12 11:10     ` Qiliang Yuan [this message]

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=20261112111055.400697-1-qiliang.yuan@linux.dev \
    --to=qiliang.yuan@linux.dev \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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®