[<prev] [next>] [day] [month] [year] [list]
Message-ID: <176833727102.510.12375639823542577165.tip-bot2@tip-bot2>
Date: Tue, 13 Jan 2026 20:47:51 -0000
From:
tip-bot2 for Jan H. Schönherr <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: jschoenh@...zon.de, David Woodhouse <dwmw@...zon.co.uk>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: perf/core] perf/core: Speed up kexec shutdown by avoiding
unnecessary cross CPU calls
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@...zon.de>
AuthorDate: Tue, 13 Jan 2026 21:34:46 +01:00
Committer: Peter Zijlstra <peterz@...radead.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@...zon.de>
Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.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);
Powered by blists - more mailing lists