diff options
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/core.c | 6 | ||||
-rw-r--r-- | kernel/events/ring_buffer.c | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 5e70f62752a2..e4aee519572d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -3569,8 +3569,10 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) | |||
3569 | if (vma->vm_flags & VM_WRITE) | 3569 | if (vma->vm_flags & VM_WRITE) |
3570 | flags |= RING_BUFFER_WRITABLE; | 3570 | flags |= RING_BUFFER_WRITABLE; |
3571 | 3571 | ||
3572 | rb = rb_alloc(nr_pages, event->attr.wakeup_watermark, | 3572 | rb = rb_alloc(nr_pages, |
3573 | event->cpu, flags); | 3573 | event->attr.watermark ? event->attr.wakeup_watermark : 0, |
3574 | event->cpu, flags); | ||
3575 | |||
3574 | if (!rb) { | 3576 | if (!rb) { |
3575 | ret = -ENOMEM; | 3577 | ret = -ENOMEM; |
3576 | goto unlock; | 3578 | goto unlock; |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index fde52595d8f7..fc2701c99207 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -199,13 +199,15 @@ void perf_output_end(struct perf_output_handle *handle) | |||
199 | struct perf_event *event = handle->event; | 199 | struct perf_event *event = handle->event; |
200 | struct ring_buffer *rb = handle->rb; | 200 | struct ring_buffer *rb = handle->rb; |
201 | 201 | ||
202 | int wakeup_events = event->attr.wakeup_events; | 202 | if (handle->sample && !event->attr.watermark) { |
203 | 203 | int wakeup_events = event->attr.wakeup_events; | |
204 | if (handle->sample && wakeup_events) { | 204 | |
205 | int events = local_inc_return(&rb->events); | 205 | if (wakeup_events) { |
206 | if (events >= wakeup_events) { | 206 | int events = local_inc_return(&rb->events); |
207 | local_sub(wakeup_events, &rb->events); | 207 | if (events >= wakeup_events) { |
208 | local_inc(&rb->wakeup); | 208 | local_sub(wakeup_events, &rb->events); |
209 | local_inc(&rb->wakeup); | ||
210 | } | ||
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||