提交 32975a4f 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

perf: Optimize perf_disable

Currently we always call hw_perf_disable(), even if its already disabled,
this seems superflous, esp. since it cannot be made NMI safe (see further
patches).
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 3f6da390
......@@ -93,25 +93,15 @@ void __weak perf_event_print_debug(void) { }
static DEFINE_PER_CPU(int, perf_disable_count);
void __perf_disable(void)
{
__get_cpu_var(perf_disable_count)++;
}
bool __perf_enable(void)
{
return !--__get_cpu_var(perf_disable_count);
}
void perf_disable(void)
{
__perf_disable();
hw_perf_disable();
if (!__get_cpu_var(perf_disable_count)++)
hw_perf_disable();
}
void perf_enable(void)
{
if (__perf_enable())
if (!--__get_cpu_var(perf_disable_count))
hw_perf_enable();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册