mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Qiliang Yuan <qiliang.yuan@linux.dev>
Cc: 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 13:59:47 +0100	[thread overview]
Message-ID: <20261112125947.GZ1813469@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261112111055.400697-1-qiliang.yuan@linux.dev>

On Thu, Nov 12, 2026 at 06:10:55AM -0500, Qiliang Yuan wrote:
> 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.

*groan*

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

So CPU hotplug is a slow path; there's nothing that's going to 'fix'
that. If it hurts, its one of those things you need to stop doing.

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

Right, that is a bit daft. It should be relatively straight forward to
make that one loop.

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

Not ideal, but again, you did do hotplug so you get to keep the pieces.

> 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().

So the actual hotplug code obviously knows. It should be fairly simple
to add a boolean argument to both functions and set the right value in
rq_attach_root() and sched_set_rq_{on,off}line() respectively.



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

Thread overview: 6+ 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
2026-11-12 12:59       ` Peter Zijlstra [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=20261112125947.GZ1813469@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --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=qiliang.yuan@linux.dev \
    --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®