All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Paul Mackerras <paulus@samba.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update()
Date: Wed, 09 Dec 2009 11:30:36 +0800	[thread overview]
Message-ID: <4B1F19DC.90204@cn.fujitsu.com> (raw)
In-Reply-To: <4B1F19A8.5040805@cn.fujitsu.com>

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);
 }
 
-- 
1.6.1.2



  reply	other threads:[~2009-12-09  3:32 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   ` Xiao Guangrong [this message]
2009-12-09  8:54     ` [PATCH 3/3] perf_event: cleanup for cpu_clock_perf_event_update() Frederic Weisbecker
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=4B1F19DC.90204@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.