Skip to content

Commit

Permalink
perf_counter, x86: fix zero irq_period counters
Browse files Browse the repository at this point in the history
The quirk to irq_period unearthed an unrobustness we had in the
hw_counter initialization sequence: we left irq_period at 0, which
was then quirked up to 2 ... which then generated a _lot_ of
interrupts during 'perf stat' runs, slowed them down and skewed
the counter results in general.

Initialize irq_period to the maximum instead.

[ Impact: fix perf stat results ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed May 17, 2009
1 parent 0203026 commit d2517a4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
hwc->nmi = 1;
}

if (!hwc->irq_period)
hwc->irq_period = x86_pmu.max_period;

atomic64_set(&hwc->period_left,
min(x86_pmu.max_period, hwc->irq_period));

Expand Down

0 comments on commit d2517a4

Please sign in to comment.