[PATCH v3 57/57] perf: Simplify perf_install_in_context()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
 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);
 }
 
 /*





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux