Commit ec89a06f authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Ingo Molnar

perf_event: Cleanup for cpu_clock_perf_event_update()

Using atomic64_xchg() instead of atomic64_read() and
atomic64_set().
Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4B1F19DC.90204@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent b93f7978
...@@ -4079,8 +4079,7 @@ static void cpu_clock_perf_event_update(struct perf_event *event) ...@@ -4079,8 +4079,7 @@ static void cpu_clock_perf_event_update(struct perf_event *event)
u64 now; u64 now;
now = cpu_clock(cpu); now = cpu_clock(cpu);
prev = atomic64_read(&event->hw.prev_count); prev = atomic64_xchg(&event->hw.prev_count, now);
atomic64_set(&event->hw.prev_count, now);
atomic64_add(now - prev, &event->count); atomic64_add(now - prev, &event->count);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment