perf_event: Cleanup for cpu_clock_perf_event_update()
authorXiao Guangrong <[email protected]>
Wed, 9 Dec 2009 03:30:36 +0000 (11:30 +0800)
committerIngo Molnar <[email protected]>
Wed, 9 Dec 2009 08:56:27 +0000 (09:56 +0100)
Using atomic64_xchg() instead of atomic64_read() and
atomic64_set().

Signed-off-by: Xiao Guangrong <[email protected]>
Reviewed-by: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
LKML-Reference: <4B1F19DC[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/perf_event.c

index 77641ae6b23fa1f581e833b28af3a8d5a31fb2c3..94e1b28333aed85c62513a6bce62d73bc12f4588 100644 (file)
@@ -4079,8 +4079,7 @@ static void cpu_clock_perf_event_update(struct perf_event *event)
        u64 now;
 
        now = cpu_clock(cpu);
-       prev = atomic64_read(&event->hw.prev_count);
-       atomic64_set(&event->hw.prev_count, now);
+       prev = atomic64_xchg(&event->hw.prev_count, now);
        atomic64_add(now - prev, &event->count);
 }