The following commit has been merged in the linux branch: commit 54f4407608c59712a8f5ec1e10dfac40bef5a2e7 Author: Soeren Sandmann sandmann@daimi.au.dk Date: Thu Oct 22 18:34:08 2009 +0200
perf events: Don't generate events for the idle task when exclude_idle is set
Getting samples for the idle task is often not interesting, so don't generate them when exclude_idle is set for the event in question.
Signed-off-by: Søren Sandmann Pedersen sandmann@redhat.com Cc: Peter Zijlstra a.p.zijlstra@chello.nl Cc: Mike Galbraith efault@gmx.de Cc: Paul Mackerras paulus@samba.org Cc: Arnaldo Carvalho de Melo acme@redhat.com Cc: Frederic Weisbecker fweisbec@gmail.com Cc: Steven Rostedt rostedt@goodmis.org LKML-Reference: ye8pr8fmlq7.fsf@camel16.daimi.au.dk Signed-off-by: Ingo Molnar mingo@elte.hu
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 33ff019..7f29643 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -3959,8 +3959,9 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) regs = task_pt_regs(current);
if (regs) { - if (perf_event_overflow(event, 0, &data, regs)) - ret = HRTIMER_NORESTART; + if (!(event->attr.exclude_idle && current->pid == 0)) + if (perf_event_overflow(event, 0, &data, regs)) + ret = HRTIMER_NORESTART; }
period = max_t(u64, 10000, event->hw.sample_period);