From: john stultz <johnstul@us.ibm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: lkml <linux-kernel@vger.kernel.org>,
Roman Zippel <zippel@linux-m68k.org>, Ingo Molnar <mingo@elte.hu>
Subject: [RFC][PATCH] export clocksource resolution (experimental)
Date: Fri, 03 Mar 2006 21:02:21 -0800 [thread overview]
Message-ID: <1141448541.9727.153.camel@cog.beaverton.ibm.com> (raw)
Hey Thomas,
Earlier there was some discussion of trying to export the clocksource
resolution so it could be used to make sure we don't expire hrtimers
early. I scratched out this first pass patch to provide an interface to
do so. Let me know if this was similar to what you were thinking of.
thanks
-john
include/linux/timeofday.h | 1 +
kernel/time/timeofday.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
linux-2.6.16-rc5_timeofday-clocksource-resolution_B20.patch
============================================
diff --git a/include/linux/timeofday.h b/include/linux/timeofday.h
index 5222c4c..fb47e82 100644
--- a/include/linux/timeofday.h
+++ b/include/linux/timeofday.h
@@ -30,6 +30,7 @@ extern int do_settimeofday(struct timesp
/* Internal functions */
extern int timeofday_is_continuous(void);
+extern u32 timeofday_get_clockres(void);
extern void timeofday_init(void);
#ifndef CONFIG_IS_TICK_BASED
diff --git a/kernel/time/timeofday.c b/kernel/time/timeofday.c
index 8085b86..5d1d6e4 100644
--- a/kernel/time/timeofday.c
+++ b/kernel/time/timeofday.c
@@ -650,6 +650,24 @@ int timeofday_is_continuous(void)
}
/**
+ * timeofday_get_clockres - returns the underlying clocksource's resolution
+ */
+u32 timeofday_get_clockres(void)
+{
+ unsigned long seq;
+ u32 res;
+ do {
+ seq = read_seqbegin(&system_time_lock);
+
+ /* take one cycle -> N+1 nsecs */
+ res = cyc2ns(clock, 0, 1) + 1;
+
+ } while (read_seqretry(&system_time_lock, seq));
+
+ return res;
+}
+
+/**
* timeofday_init - Initializes time variables
*/
void __init timeofday_init(void)
reply other threads:[~2006-03-04 5:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1141448541.9727.153.camel@cog.beaverton.ibm.com \
--to=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=zippel@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®