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

perf: Do not compute time values unnecessarily

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>

authored by

Peter Zijlstra and committed by
Ingo Molnar
5ec4c599 948b26b6

+4 -4
+4 -4
kernel/events/core.c
··· 3670 3670 u64 enabled, running, now; 3671 3671 3672 3672 rcu_read_lock(); 3673 + rb = rcu_dereference(event->rb); 3674 + if (!rb) 3675 + goto unlock; 3676 + 3673 3677 /* 3674 3678 * compute total_time_enabled, total_time_running 3675 3679 * based on snapshot values taken when the event ··· 3684 3680 * NMI context 3685 3681 */ 3686 3682 calc_timer_values(event, &now, &enabled, &running); 3687 - rb = rcu_dereference(event->rb); 3688 - if (!rb) 3689 - goto unlock; 3690 3683 3691 3684 userpg = rb->user_page; 3692 - 3693 3685 /* 3694 3686 * Disable preemption so as to not let the corresponding user-space 3695 3687 * spin too long if we get preempted.