public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Paul Mackerras <paulus@samba.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update()
Date: Wed, 9 Dec 2009 09:54:19 +0100	[thread overview]
Message-ID: <20091209085417.GC5152@nowhere> (raw)
In-Reply-To: <4B1F19DC.90204@cn.fujitsu.com>

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>


  reply	other threads:[~2009-12-09  8:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09  3:28 [PATCH 1/3] perf_event: cleanup for __perf_event_init_context() Xiao Guangrong
2009-12-09  3:29 ` [PATCH 2/3] perf_event: allocate children's perf_event_ctxp at the right time Xiao Guangrong
2009-12-09  3:30   ` [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update() Xiao Guangrong
2009-12-09  8:54     ` Frederic Weisbecker [this message]
2009-12-09  9:52     ` [tip:perf/urgent] perf_event: Cleanup " tip-bot for Xiao Guangrong
2009-12-09  8:43   ` [PATCH 2/3] perf_event: allocate children's perf_event_ctxp at the right time Frederic Weisbecker
2009-12-09  9:52   ` [tip:perf/urgent] perf_event: Allocate " tip-bot for Xiao Guangrong
2009-12-09  8:33 ` [PATCH 1/3] perf_event: cleanup for __perf_event_init_context() Frederic Weisbecker
2009-12-09  9:52 ` [tip:perf/urgent] perf_event: Clean up __perf_event_init_context() tip-bot for Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091209085417.GC5152@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox