Commit 128f048f authored by Ingo Molnar's avatar Ingo Molnar

perf_counter: Fix throttling lock-up

Throttling logic is broken and we can lock up with too small
hw sampling intervals.

Make the throttling code more robust: disable counters even
if we already disabled them.

( Also clean up whitespace damage i noticed while reading
  various pieces of code related to throttling. )

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 233f0b95
...@@ -2822,13 +2822,22 @@ int perf_counter_overflow(struct perf_counter *counter, ...@@ -2822,13 +2822,22 @@ int perf_counter_overflow(struct perf_counter *counter,
if (!throttle) { if (!throttle) {
counter->hw.interrupts++; counter->hw.interrupts++;
} else if (counter->hw.interrupts != MAX_INTERRUPTS) { } else {
if (counter->hw.interrupts != MAX_INTERRUPTS) {
counter->hw.interrupts++; counter->hw.interrupts++;
if (HZ*counter->hw.interrupts > (u64)sysctl_perf_counter_limit) { if (HZ*counter->hw.interrupts > (u64)sysctl_perf_counter_limit) {
counter->hw.interrupts = MAX_INTERRUPTS; counter->hw.interrupts = MAX_INTERRUPTS;
perf_log_throttle(counter, 0); perf_log_throttle(counter, 0);
ret = 1; ret = 1;
} }
} else {
/*
* Keep re-disabling counters even though on the previous
* pass we disabled it - just in case we raced with a
* sched-in and the counter got enabled again:
*/
ret = 1;
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment