summaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 995063df910..9bcab10e735 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1760,7 +1760,15 @@ static void perf_output_copy(struct perf_output_handle *handle,
static void perf_output_end(struct perf_output_handle *handle)
{
- if (handle->wakeup)
+ int wakeup_events = handle->counter->hw_event.wakeup_events;
+
+ if (wakeup_events) {
+ int events = atomic_inc_return(&handle->data->events);
+ if (events >= wakeup_events) {
+ atomic_sub(wakeup_events, &handle->data->events);
+ __perf_output_wakeup(handle);
+ }
+ } else if (handle->wakeup)
__perf_output_wakeup(handle);
rcu_read_unlock();
}