aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-15 09:19:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-15 09:26:56 -0400
commit60db5e09c13109b13830cc9dcae688003fd39e79 (patch)
treeac923b89c28d735d2460216202d960e9c6237be0 /arch/x86
parent789f90fcf6b0b54e655740e9396c954378542c79 (diff)
perf_counter: frequency based adaptive irq_period
Instead of specifying the irq_period for a counter, provide a target interrupt frequency and dynamically adapt the irq_period to match this frequency. [ Impact: new perf-counter attribute/feature ] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <20090515132018.646195868@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/perf_counter.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 5a7f718eb1e1..886dcf334bc3 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -286,11 +286,8 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
286 hwc->nmi = 1; 286 hwc->nmi = 1;
287 } 287 }
288 288
289 hwc->irq_period = hw_event->irq_period; 289 atomic64_set(&hwc->period_left,
290 if ((s64)hwc->irq_period <= 0 || hwc->irq_period > x86_pmu.max_period) 290 min(x86_pmu.max_period, hwc->irq_period));
291 hwc->irq_period = x86_pmu.max_period;
292
293 atomic64_set(&hwc->period_left, hwc->irq_period);
294 291
295 /* 292 /*
296 * Raw event type provide the config in the event structure 293 * Raw event type provide the config in the event structure
@@ -458,7 +455,7 @@ x86_perf_counter_set_period(struct perf_counter *counter,
458 struct hw_perf_counter *hwc, int idx) 455 struct hw_perf_counter *hwc, int idx)
459{ 456{
460 s64 left = atomic64_read(&hwc->period_left); 457 s64 left = atomic64_read(&hwc->period_left);
461 s64 period = hwc->irq_period; 458 s64 period = min(x86_pmu.max_period, hwc->irq_period);
462 int err; 459 int err;
463 460
464 /* 461 /*