lkml.org 
[lkml]   [2009]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update()
On Wed, Dec 09, 2009 at 11:30:36AM +0800, Xiao Guangrong wrote:
> Using atomic64_xchg() instead of atomic64_read() and atomic64_set().
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
> kernel/perf_event.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 592b293..8f46012 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -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);
> }


Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>



\
 
 \ /
  Last update: 2009-12-09 09:57    [W:0.053 / U:11.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site