[PATCH v3 57/57] perf: Simplify perf_install_in_context()
Peter Zijlstra
peterz at infradead.org
Mon Jun 12 09:08:10 UTC 2023
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
---
kernel/events/core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2876,7 +2876,7 @@ perf_install_in_context(struct perf_even
if (!task_function_call(task, __perf_install_in_context, event))
return;
- raw_spin_lock_irq(&ctx->lock);
+ guard(raw_spinlock_irq)(&ctx->lock);
task = ctx->task;
if (WARN_ON_ONCE(task == TASK_TOMBSTONE)) {
/*
@@ -2884,19 +2884,15 @@ perf_install_in_context(struct perf_even
* cannot happen), and we hold ctx->mutex, which serializes us
* against perf_event_exit_task_context().
*/
- raw_spin_unlock_irq(&ctx->lock);
return;
}
/*
* If the task is not running, ctx->lock will avoid it becoming so,
* thus we can safely install the event.
*/
- if (task_curr(task)) {
- raw_spin_unlock_irq(&ctx->lock);
+ if (task_curr(task))
goto again;
- }
add_event_to_ctx(event, ctx);
- raw_spin_unlock_irq(&ctx->lock);
}
/*
More information about the Linux-security-module-archive
mailing list