From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
john stultz <johnstul@us.ibm.com>,
linux-kernel@vger.kernel.org
Cc: Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 2/3] sched_clock: record TSC after gtod
Date: Wed, 09 Jul 2008 00:15:32 -0400 [thread overview]
Message-ID: <20080709041825.355150582@goodmis.org> (raw)
In-Reply-To: 20080709041530.668120406@goodmis.org
[-- Attachment #1: sched_clock-reverse-order-raw-gtod.patch --]
[-- Type: text/plain, Size: 953 bytes --]
To read the gtod we need to grab the xtime lock for read. Reading the gtod
before the TSC can cause a bigger gab if the xtime lock is contended.
This patch simply reverses the order to read the TSC after the gtod.
The locking in the reading of the gtod handles any barriers one might
think is needed.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/sched_clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-tip.git/kernel/sched_clock.c
===================================================================
--- linux-tip.git.orig/kernel/sched_clock.c 2008-07-08 11:03:05.000000000 -0400
+++ linux-tip.git/kernel/sched_clock.c 2008-07-08 16:53:34.000000000 -0400
@@ -237,8 +237,8 @@ void sched_clock_tick(void)
WARN_ON_ONCE(!irqs_disabled());
- now = sched_clock();
now_gtod = ktime_to_ns(ktime_get());
+ now = sched_clock();
__raw_spin_lock(&scd->lock);
__update_sched_clock(scd, now, NULL);
--
next prev parent reply other threads:[~2008-07-09 4:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-09 4:15 [PATCH 0/3] [PATCH] more sched_clock updates Steven Rostedt
2008-07-09 4:15 ` [PATCH 1/3] sched_clock: only update deltas with local reads Steven Rostedt
2008-07-09 4:15 ` Steven Rostedt [this message]
2008-07-09 4:15 ` [PATCH 3/3] sched_clock: and multiplier for TSC to gtod drift Steven Rostedt
2008-07-11 13:56 ` [PATCH 0/3] [PATCH] more sched_clock updates Ingo Molnar
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=20080709041825.355150582@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srostedt@redhat.com \
--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