perf: Optimize perf_output_*() by avoiding local_xchg()
Since the x86 XCHG ins implies LOCK, avoid the use by using a sequence count instead. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
fa5881514e
commit
6d1acfd5c6
@ -804,6 +804,7 @@ struct perf_output_handle {
|
|||||||
struct perf_mmap_data *data;
|
struct perf_mmap_data *data;
|
||||||
unsigned long head;
|
unsigned long head;
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
|
unsigned long wakeup;
|
||||||
int nmi;
|
int nmi;
|
||||||
int sample;
|
int sample;
|
||||||
};
|
};
|
||||||
|
@ -2917,6 +2917,7 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
|
|||||||
|
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
local_inc(&data->nest);
|
local_inc(&data->nest);
|
||||||
|
handle->wakeup = local_read(&data->wakeup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perf_output_put_handle(struct perf_output_handle *handle)
|
static void perf_output_put_handle(struct perf_output_handle *handle)
|
||||||
@ -2950,7 +2951,7 @@ again:
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_xchg(&data->wakeup, 0))
|
if (handle->wakeup != local_read(&data->wakeup))
|
||||||
perf_output_wakeup(handle);
|
perf_output_wakeup(handle);
|
||||||
|
|
||||||
preempt_enable();
|
preempt_enable();
|
||||||
|
Loading…
Reference in New Issue
Block a user