From: john stultz <johnstul@us.ibm.com>
To: Thomas Schlichter <schlicht@uni-mannheim.de>
Cc: "Prakash K. Cheemplavam" <prakashpublic@gmx.de>,
"Ronny V. Vindenes" <s864@ii.uib.no>,
Andrew Morton <akpm@osdl.org>,
lkml <linux-kernel@vger.kernel.org>,
cat@zip.com.au, gawain@freda.homelinux.org,
gene.heskett@verizon.net, papadako@csd.uoc.gr,
Rick Lindsley <ricklind@us.ibm.com>,
"Martin J. Bligh" <mbligh@aracnet.com>
Subject: Re: Terrible interactivity with 2.6.0-t9-mm3
Date: 17 Nov 2003 14:44:54 -0800 [thread overview]
Message-ID: <1069109094.11432.1989.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <1069104441.11424.1979.camel@cog.beaverton.ibm.com>
On Mon, 2003-11-17 at 13:27, john stultz wrote:
> On Mon, 2003-11-17 at 11:46, Thomas Schlichter wrote:
> > The problem is that sched_clock() uses the TSC if the hardware supports it.
> > But the needed scaling factors are only initialized in init_tsc() and
> > init_hpet(). So there are 2 possibilities to fix this:
> > 1. Call the neccessary parts of init_tsc() in init_pmtmr() and init_pit().
> > 2. Use the TSC in sched_clock() only if "clock=tsc" was set.
>
> As far as sched_clock() goes, I haven't followed its development
> closely, but it seem that it is very close to monotonic_clock() in
> functionality. The benefit of monotonic_clock is that it is implemented
> for each time source (however its not implemented for every arch). For
> i386 at least, we may want to make sched_clock just call
> monotonic_clock, but I need to look into the details.
Here's a patch that does the above. I'm not very aware of the issues
around the scheduler so I'm not sure if the cost of going off chip to
the cyclone or ACPI PM time sources are just outright, but for the TSC
case monotonic_clock() is basically the same function as sched_clock().
So this might be the best fix for systems not using the TSC as a time
source.
I'd be interested to hear if it has any effect on performance.
thanks
-john
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c Mon Nov 17 14:36:32 2003
+++ b/arch/i386/kernel/time.c Mon Nov 17 14:36:32 2003
@@ -190,6 +190,12 @@
}
EXPORT_SYMBOL(monotonic_clock);
+/* sched_clock() ~== monotonic_clock() */
+unsigned long long sched_clock(void)
+{
+ return cur_timer->monotonic_clock();
+}
+
/*
* timer_interrupt() needs to keep up the real-time clock,
diff -Nru a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c
--- a/arch/i386/kernel/timers/timer_pit.c Mon Nov 17 14:36:32 2003
+++ b/arch/i386/kernel/timers/timer_pit.c Mon Nov 17 14:36:32 2003
@@ -37,7 +37,7 @@
static unsigned long long monotonic_clock_pit(void)
{
- return 0;
+ return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
}
static void delay_pit(unsigned long loops)
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c Mon Nov 17 14:36:32 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c Mon Nov 17 14:36:32 2003
@@ -127,30 +127,6 @@
return base + cycles_2_ns(this_offset - last_offset);
}
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
- unsigned long long this_offset;
-
- /*
- * In the NUMA case we dont use the TSC as they are not
- * synchronized across all CPUs.
- */
-#ifndef CONFIG_NUMA
- if (unlikely(!cpu_has_tsc))
-#endif
- return (unsigned long long)jiffies * (1000000000 / HZ);
-
- /* Read the Time Stamp Counter */
- rdtscll(this_offset);
-
- /* return the value in ns */
- return cycles_2_ns(this_offset);
-}
-
-
static void mark_offset_tsc(void)
{
unsigned long lost,delay;
next prev parent reply other threads:[~2003-11-17 22:50 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-17 12:11 Ronny V. Vindenes
2003-11-17 13:12 ` Prakash K. Cheemplavam
2003-11-17 19:46 ` Thomas Schlichter
2003-11-17 21:27 ` john stultz
2003-11-17 22:44 ` john stultz [this message]
2003-11-17 22:51 ` Prakash K. Cheemplavam
2003-11-17 22:55 ` john stultz
2003-11-17 23:04 ` john stultz
2003-11-17 23:46 ` Thomas Schlichter
2003-11-18 22:59 ` linux-2.6.0-test9-mm3_acpi-pm-monotonic-fix_A0 john stultz
2003-11-19 7:34 ` linux-2.6.0-test9-mm3_acpi-pm-monotonic-fix_A0 Thomas Schlichter
2003-11-18 13:24 ` Terrible interactivity with 2.6.0-t9-mm3 Prakash K. Cheemplavam
2003-11-18 16:11 ` Prakash K. Cheemplavam
2003-11-18 18:28 ` john stultz
2003-11-18 16:15 ` Prakash K. Cheemplavam
2003-11-17 13:15 ` Felipe Alfaro Solana
2003-11-17 19:36 ` Andrew Morton
2003-11-17 19:35 ` john stultz
2003-11-18 18:56 ` Dominik Brodowski
2003-11-18 19:18 ` john stultz
-- strict thread matches above, loose matches on Subject: below --
2003-11-16 19:26 CaT
2003-11-16 20:24 ` Prakash K. Cheemplavam
2003-11-16 21:42 ` Andrew Morton
2003-11-16 22:06 ` Arnaldo Carvalho de Melo
2003-11-16 22:13 ` Andrew Morton
2003-11-16 22:18 ` CaT
2003-11-17 0:16 ` Panagiotis Papadakos
2003-11-17 2:20 ` Gawain Lynch
2003-11-17 2:49 ` Andrew Morton
2003-11-17 3:11 ` Gawain Lynch
2003-11-17 3:54 ` Gene Heskett
2003-11-17 4:19 ` Nick Piggin
2003-11-17 4:47 ` Gene Heskett
2003-11-17 5:17 ` Nick Piggin
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=1069109094.11432.1989.camel@cog.beaverton.ibm.com \
--to=johnstul@us.ibm.com \
--cc=akpm@osdl.org \
--cc=cat@zip.com.au \
--cc=gawain@freda.homelinux.org \
--cc=gene.heskett@verizon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=papadako@csd.uoc.gr \
--cc=prakashpublic@gmx.de \
--cc=ricklind@us.ibm.com \
--cc=s864@ii.uib.no \
--cc=schlicht@uni-mannheim.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
Powered by JetHome