Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169625
b: refs/heads/master
c: 559fdc3
h: refs/heads/master
i:
  169623: 4081ef3
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Nov 16, 2009
1 parent b7ac8f7 commit 3f9b1a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 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: 7255fe2a42c612f2b8fe4c347f0a5f0c97d85a46
refs/heads/master: 559fdc3c1b624edb1933a875022fe7e27934d11c
1 change: 0 additions & 1 deletion trunk/include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ struct perf_output_handle {
int nmi;
int sample;
int locked;
unsigned long flags;
};

#ifdef CONFIG_PERF_EVENTS
Expand Down
21 changes: 11 additions & 10 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2674,20 +2674,21 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
static void perf_output_lock(struct perf_output_handle *handle)
{
struct perf_mmap_data *data = handle->data;
int cpu;
int cur, cpu = get_cpu();

handle->locked = 0;

local_irq_save(handle->flags);
cpu = smp_processor_id();

if (in_nmi() && atomic_read(&data->lock) == cpu)
return;
for (;;) {
cur = atomic_cmpxchg(&data->lock, -1, cpu);
if (cur == -1) {
handle->locked = 1;
break;
}
if (cur == cpu)
break;

while (atomic_cmpxchg(&data->lock, -1, cpu) != -1)
cpu_relax();

handle->locked = 1;
}
}

static void perf_output_unlock(struct perf_output_handle *handle)
Expand Down Expand Up @@ -2733,7 +2734,7 @@ static void perf_output_unlock(struct perf_output_handle *handle)
if (atomic_xchg(&data->wakeup, 0))
perf_output_wakeup(handle);
out:
local_irq_restore(handle->flags);
put_cpu();
}

void perf_output_copy(struct perf_output_handle *handle,
Expand Down

0 comments on commit 3f9b1a8

Please sign in to comment.