diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-02-16 13:27:18 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-16 13:27:23 +0100 |
commit | b00560f2d4de69bb12f66f9605985b516df98d77 (patch) | |
tree | 0c92fc994125dc3ddb635842715be29d8b16808b /kernel/perf_event.c | |
parent | bf1af3a809506645b9130755b713b008da14737f (diff) | |
parent | 4fe757dd48a9e95e1a071291f15dda5421dacb66 (diff) | |
download | op-kernel-dev-b00560f2d4de69bb12f66f9605985b516df98d77.zip op-kernel-dev-b00560f2d4de69bb12f66f9605985b516df98d77.tar.gz |
Merge branch 'perf/urgent' into perf/core
Merge reason: we need to queue up dependent patch
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index a353a4d..3d3f282 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -851,6 +851,10 @@ retry: raw_spin_unlock_irq(&ctx->lock); } +#define MAX_INTERRUPTS (~0ULL) + +static void perf_log_throttle(struct perf_event *event, int enable); + static int event_sched_in(struct perf_event *event, struct perf_cpu_context *cpuctx, @@ -863,6 +867,17 @@ event_sched_in(struct perf_event *event, event->state = PERF_EVENT_STATE_ACTIVE; event->oncpu = smp_processor_id(); + + /* + * Unthrottle events, since we scheduled we might have missed several + * ticks already, also for a heavily scheduling task there is little + * guarantee it'll get a tick in a timely manner. + */ + if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) { + perf_log_throttle(event, 1); + event->hw.interrupts = 0; + } + /* * The new state must be visible before we turn it on in the hardware: */ @@ -1661,10 +1676,6 @@ void __perf_event_task_sched_in(struct task_struct *task) } } -#define MAX_INTERRUPTS (~0ULL) - -static void perf_log_throttle(struct perf_event *event, int enable); - static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) { u64 frequency = event->attr.sample_freq; |