aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-11-20 16:19:50 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-21 08:11:38 -0500
commit02ffdbc866c8b1c8644601e9aa6155700eed4c91 (patch)
treefd5c0cfbbadc22e123aa25c17c74ac69f8b14887 /kernel/perf_event.c
parentabf4868b8548cae18d4fe8bbfb4e207443be01be (diff)
perf: Optimize perf_event_task_sched_out
Remove an update_context_time() call from the perf_event_task_sched_out() path and into the branch its needed. The call was both superfluous, because __perf_event_sched_out() already does it, and wrong, because it was done without holding ctx->lock. Place it in perf_event_sync_stat(), which is the only place it is needed and which does already hold ctx->lock. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <20091120212508.779516394@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9a18ff28ea5b..65f4dab0ce60 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1120,6 +1120,8 @@ static void perf_event_sync_stat(struct perf_event_context *ctx,
1120 if (!ctx->nr_stat) 1120 if (!ctx->nr_stat)
1121 return; 1121 return;
1122 1122
1123 update_context_time(ctx);
1124
1123 event = list_first_entry(&ctx->event_list, 1125 event = list_first_entry(&ctx->event_list,
1124 struct perf_event, event_entry); 1126 struct perf_event, event_entry);
1125 1127
@@ -1163,8 +1165,6 @@ void perf_event_task_sched_out(struct task_struct *task,
1163 if (likely(!ctx || !cpuctx->task_ctx)) 1165 if (likely(!ctx || !cpuctx->task_ctx))
1164 return; 1166 return;
1165 1167
1166 update_context_time(ctx);
1167
1168 rcu_read_lock(); 1168 rcu_read_lock();
1169 parent = rcu_dereference(ctx->parent_ctx); 1169 parent = rcu_dereference(ctx->parent_ctx);
1170 next_ctx = next->perf_event_ctxp; 1170 next_ctx = next->perf_event_ctxp;