Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257058
b: refs/heads/master
c: 4ec8363
h: refs/heads/master
v: v3
  • Loading branch information
Vince Weaver authored and Ingo Molnar committed Jul 1, 2011
1 parent 3e47929 commit 3793142
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 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: 0f933625e7b6c3d91878ae95e341bf1984db7eaf
refs/heads/master: 4ec8363dfc1451f8c8f86825731fe712798ada02
6 changes: 4 additions & 2 deletions trunk/kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3569,8 +3569,10 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
if (vma->vm_flags & VM_WRITE)
flags |= RING_BUFFER_WRITABLE;

rb = rb_alloc(nr_pages, event->attr.wakeup_watermark,
event->cpu, flags);
rb = rb_alloc(nr_pages,
event->attr.watermark ? event->attr.wakeup_watermark : 0,
event->cpu, flags);

if (!rb) {
ret = -ENOMEM;
goto unlock;
Expand Down
16 changes: 9 additions & 7 deletions trunk/kernel/events/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,15 @@ void perf_output_end(struct perf_output_handle *handle)
struct perf_event *event = handle->event;
struct ring_buffer *rb = handle->rb;

int wakeup_events = event->attr.wakeup_events;

if (handle->sample && wakeup_events) {
int events = local_inc_return(&rb->events);
if (events >= wakeup_events) {
local_sub(wakeup_events, &rb->events);
local_inc(&rb->wakeup);
if (handle->sample && !event->attr.watermark) {
int wakeup_events = event->attr.wakeup_events;

if (wakeup_events) {
int events = local_inc_return(&rb->events);
if (events >= wakeup_events) {
local_sub(wakeup_events, &rb->events);
local_inc(&rb->wakeup);
}
}
}

Expand Down

0 comments on commit 3793142

Please sign in to comment.