public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
	mingo@redhat.com, peterz@infradead.org,
	xiaoguangrong@cn.fujitsu.com, fweisbec@gmail.com,
	tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/urgent] perf_event: Cleanup for cpu_clock_perf_event_update()
Date: Wed, 9 Dec 2009 09:52:40 GMT	[thread overview]
Message-ID: <tip-ec89a06fd4e12301f11ab039ee07d2353a18addc@git.kernel.org> (raw)
In-Reply-To: <4B1F19DC.90204@cn.fujitsu.com>

Commit-ID:  ec89a06fd4e12301f11ab039ee07d2353a18addc
Gitweb:     http://git.kernel.org/tip/ec89a06fd4e12301f11ab039ee07d2353a18addc
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Wed, 9 Dec 2009 11:30:36 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 09:56:27 +0100

perf_event: Cleanup for cpu_clock_perf_event_update()

Using atomic64_xchg() instead of atomic64_read() and
atomic64_set().

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Frederic 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: Ingo Molnar <mingo@elte.hu>
---
 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 77641ae..94e1b28 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);
 }
 

  parent reply	other threads:[~2009-12-09  9:53 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
2009-12-09  9:52     ` tip-bot for Xiao Guangrong [this message]
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=tip-ec89a06fd4e12301f11ab039ee07d2353a18addc@git.kernel.org \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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