From: Peter Zijlstra <peterz@infradead.org>
To: David Wang <00107082@163.com>
Cc: mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
mingo@kernel.org, yeoreum.yun@arm.com, leo.yan@arm.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf/core: restore __perf_remove_from_context when DETACH_EXIT not set
Date: Tue, 3 Jun 2025 14:54:40 +0200 [thread overview]
Message-ID: <20250603125440.GA35970@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250603125056.GI39944@noisy.programming.kicks-ass.net>
On Tue, Jun 03, 2025 at 02:50:56PM +0200, Peter Zijlstra wrote:
> On Tue, Jun 03, 2025 at 06:44:58PM +0800, David Wang wrote:
>
>
> > (As yeoreum.yun@arm.com pointed out, the change in perf_remove_from_context() made
> > perf_event_set_state() happened before list_del_event(), resulting in perf_cgroup_event_disable()
> > not called.)
>
> Aah, d'0h. Let me see what we should do there.
Does this help? This way event_sched_out() will call
perf_cgroup_event_disable().
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f34c99f8ce8f..adbb0372825f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2494,9 +2494,9 @@ __perf_remove_from_context(struct perf_event *event,
if (flags & DETACH_REVOKE)
state = PERF_EVENT_STATE_REVOKED;
if (flags & DETACH_DEAD) {
- event->pending_disable = 1;
state = PERF_EVENT_STATE_DEAD;
}
+ event->pending_disable = 1;
event_sched_out(event, ctx);
perf_event_set_state(event, min(event->state, state));
next prev parent reply other threads:[~2025-06-03 12:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 3:26 [PATCH] perf/core: restore __perf_remove_from_context when DETACH_EXIT not set David Wang
2025-06-03 8:33 ` [PATCH v2] " David Wang
2025-06-03 9:13 ` Peter Zijlstra
2025-06-03 10:44 ` David Wang
2025-06-03 12:50 ` Peter Zijlstra
2025-06-03 12:54 ` Peter Zijlstra [this message]
2025-06-03 13:03 ` David Wang
2025-06-03 13:49 ` David Wang
2025-06-03 13:22 ` Yeoreum Yun
2025-06-03 14:08 ` Peter Zijlstra
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=20250603125440.GA35970@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=00107082@163.com \
--cc=acme@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=yeoreum.yun@arm.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