Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jan H. Schönherr and committed by
Peter Zijlstra
eebe6446 a491c02c

+2 -1
+2 -1
kernel/events/core.c
··· 15066 15066 ctx = &cpuctx->ctx; 15067 15067 15068 15068 mutex_lock(&ctx->mutex); 15069 - smp_call_function_single(cpu, __perf_event_exit_context, ctx, 1); 15069 + if (ctx->nr_events) 15070 + smp_call_function_single(cpu, __perf_event_exit_context, ctx, 1); 15070 15071 cpuctx->online = 0; 15071 15072 mutex_unlock(&ctx->mutex); 15072 15073 mutex_unlock(&pmus_lock);