Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233551
b: refs/heads/master
c: 4fe757d
h: refs/heads/master
i:
  233549: 95ed869
  233547: 0e44b8b
  233543: 25c92c1
  233535: 678e63f
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Feb 16, 2011
1 parent 1159009 commit 3c3441a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d44ec193d95416d1342cdd86392a1eeb7461186
refs/heads/master: 4fe757dd48a9e95e1a071291f15dda5421dacb66
19 changes: 15 additions & 4 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,10 @@ void perf_event_disable(struct perf_event *event)
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,
Expand All @@ -794,6 +798,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:
*/
Expand Down Expand Up @@ -1596,10 +1611,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;
Expand Down

0 comments on commit 3c3441a

Please sign in to comment.