Skip to content

Commit

Permalink
perf: Do not compute time values unnecessarily
Browse files Browse the repository at this point in the history
We should not be calling calc_timer_values() for events that do not actually
have an mmap()'ed userpage.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20130802191630.GT27162@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 16, 2013
1 parent 948b26b commit 5ec4c59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3670,6 +3670,10 @@ void perf_event_update_userpage(struct perf_event *event)
u64 enabled, running, now;

rcu_read_lock();
rb = rcu_dereference(event->rb);
if (!rb)
goto unlock;

/*
* compute total_time_enabled, total_time_running
* based on snapshot values taken when the event
Expand All @@ -3680,12 +3684,8 @@ void perf_event_update_userpage(struct perf_event *event)
* NMI context
*/
calc_timer_values(event, &now, &enabled, &running);
rb = rcu_dereference(event->rb);
if (!rb)
goto unlock;

userpg = rb->user_page;

/*
* Disable preemption so as to not let the corresponding user-space
* spin too long if we get preempted.
Expand Down

0 comments on commit 5ec4c59

Please sign in to comment.