From: "tip-bot2 for Jan H. Schönherr" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: jschoenh@amazon.de, David Woodhouse <dwmw@amazon.co.uk>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf/core: Speed up kexec shutdown by avoiding unnecessary cross CPU calls
Date: Tue, 13 Jan 2026 20:47:51 -0000 [thread overview]
Message-ID: <176833727102.510.12375639823542577165.tip-bot2@tip-bot2> (raw)
The following commit has been merged into the perf/core branch of tip:
Commit-ID: eebe6446ccb75ecb36cb145ab1cbc3db06cbc8d6
Gitweb: https://git.kernel.org/tip/eebe6446ccb75ecb36cb145ab1cbc3db06cbc8d6
Author: Jan H. Schönherr <jschoenh@amazon.de>
AuthorDate: Tue, 13 Jan 2026 21:34:46 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 13 Jan 2026 21:39:01 +01:00
perf/core: Speed up kexec shutdown by avoiding unnecessary cross CPU calls
There are typically a lot of PMUs registered, but in many cases only few
of them have an event registered (like the "cpu" PMU in the presence of
the watchdog). As the mutex is already held, it's safe to just check for
existing events before doing the cross CPU call.
This change saves tens of milliseconds from kexec time (perceived as
steal time during a hypervisor host update), with <2ms remaining for
this step in the shutdown. There might be additional potential for
parallelization or we could just disable performance monitoring during
the actual shutdown and be less graceful about it.
Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/events/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 376fb07..101da5c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -15066,7 +15066,8 @@ static void perf_event_exit_cpu_context(int cpu)
ctx = &cpuctx->ctx;
mutex_lock(&ctx->mutex);
- smp_call_function_single(cpu, __perf_event_exit_context, ctx, 1);
+ if (ctx->nr_events)
+ smp_call_function_single(cpu, __perf_event_exit_context, ctx, 1);
cpuctx->online = 0;
mutex_unlock(&ctx->mutex);
mutex_unlock(&pmus_lock);
next reply other threads:[~2026-01-13 20:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 20:47 tip-bot2 for Jan H. Schönherr [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-01-08 10:14 [PATCH] " David Woodhouse
2026-01-13 10:50 ` [tip: perf/core] " tip-bot2 for Jan H. Sch=C3=B6nherr
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=176833727102.510.12375639823542577165.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=dwmw@amazon.co.uk \
--cc=jschoenh@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@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®