Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qiliang Yuan" <qiliang.yuan@linux.dev>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf/core: Skip cgroup attach IPIs while perf_sched_events is disabled
Date: Sun, 22 Nov 2026 02:10:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-227640@kernel.org> (raw)
In-Reply-To: <20261121-feat-perf-cgroup-attach-ipi-v1-1-a0e6d3cce8d1@linux.dev>

> The perf_event controller is implicitly enabled on cgroup v2, so moving
> tasks to another cgroup calls perf_cgroup_attach(). For every migrated
> thread, it calls task_function_call(), which sends a synchronous IPI to
> the CPU the thread last ran on, so that a CPU counting cgroup events
> switches to the new cgroup if the thread is running there.
> 
> Without cgroup events, no CPU tracks a cgroup and perf_cgroup_switch()
> returns right away, yet every thread still costs an IPI. Moving a
> process with hundreds of threads, such as an inference server, then
> takes milliseconds, all with cgroup_threadgroup_rwsem held for writing,
> which blocks fork() and exit() on the whole system.
> 
> Return early when perf_sched_events is disabled. A cgroup event enables
> it and waits for a grace period before it is installed. With a full
> barrier before the key check, the grace period orders the cgroup changes
> [ ... ]
>        16      4.1 (3.8-5.0)   3.7 (3.6-3.8)     -11%
>       128     9.8 (9.5-10.1)   3.7 (3.6-3.8)     -63%
>       512   21.6 (20.8-22.7)   4.8 (4.7-4.9)     -78%
> 
> Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261121-feat-perf-cgroup-attach-ipi-v1-1-a0e6d3cce8d1@linux.dev?part=1

      reply	other threads:[~2026-11-22  2:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  2:03 [PATCH] perf/core: Skip cgroup attach IPIs while perf_sched_events is disabled Qiliang Yuan
2026-11-22  2:10 ` sashiko-bot [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=sashiko-outbox-227640@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=qiliang.yuan@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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