From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <andi@firstfloor.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Satyam Sharma <satyam.sharma@gmail.com>,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [patch] sched_clock(): cleanups, #2
Date: Fri, 25 May 2007 13:50:04 +0200 [thread overview]
Message-ID: <20070525115004.GA4574@elte.hu> (raw)
In-Reply-To: <20070525112600.GA27007@elte.hu>
* Ingo Molnar <mingo@elte.hu> wrote:
> * Andi Kleen <andi@firstfloor.org> wrote:
>
> > > please send me your current sched-clock.c, i'll redo any remaining
> > > cleanups.
> >
> > It needs at least one new preliminary patch (to add on_cpu_single);
> > please get the series from
> > ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt/patches-2.6.22-rc2-git7-070525-1.tar.gz
> > You need at least tsc-unstable upto paravirt-add-a-sched_clock-paravirt
> > for everything
>
> thanks.
>
> you missed one patch: please pick up the NUMAQ change i did too. (i
> kept the printk to make sure someone notices that and actually tests
> thing - i dont have a NUMAQ machine to try this on.)
>
> i'm looking at the other things now.
find below the cleanups from my first patch that didnt make it into your
cleanups. (plus one more cleanup i noticed while merging the missing
bits from my first patch) Goes after the bugfix i just sent. Please
apply.
Ingo
---------------------->
Subject: [patch] sched_clock(): cleanups, #2
From: Ingo Molnar <mingo@elte.hu>
clean up sched-clock.c - the missing bits.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/i386/kernel/sched-clock.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
Index: linux-cfs-2.6.22-rc2-mm1.q/arch/i386/kernel/sched-clock.c
===================================================================
--- linux-cfs-2.6.22-rc2-mm1.q.orig/arch/i386/kernel/sched-clock.c
+++ linux-cfs-2.6.22-rc2-mm1.q/arch/i386/kernel/sched-clock.c
@@ -89,8 +89,10 @@ unsigned long long native_sched_clock(vo
return r;
}
-/* We need to define a real function for sched_clock, to override the
- weak default version */
+/*
+ * We need to define a real function for sched_clock, to override the
+ * weak default version
+ */
#ifdef CONFIG_PARAVIRT
unsigned long long sched_clock(void)
{
@@ -119,6 +121,9 @@ static void resolve_freq(struct cpufreq_
{
if (!freq->new) {
freq->new = cpufreq_get(freq->cpu);
+ /*
+ * Still no frequency? Then fall back to tsc_khz:
+ */
if (!freq->new)
freq->new = tsc_khz;
}
@@ -129,6 +134,7 @@ static void resync_freq(void *arg)
{
struct cpufreq_freqs *freq = (void *)arg;
struct sc_data *sc = &__get_cpu_var(sc_data);
+
sc->sync_base = jiffies;
if (!cpu_has_tsc) {
sc->unstable = 1;
@@ -155,13 +161,14 @@ static void resync_freq(void *arg)
static void resync_freq_on_cpu(void *arg)
{
struct cpufreq_freqs f = { .new = 0 };
+
f.cpu = get_cpu();
resync_freq(&f);
put_cpu();
}
-static int sc_freq_event(struct notifier_block *nb, unsigned long event,
- void *data)
+static int
+sc_freq_event(struct notifier_block *nb, unsigned long event, void *data)
{
struct cpufreq_freqs *freq = data;
struct sc_data *sc;
@@ -210,8 +217,10 @@ static int __cpuinit
sc_cpu_event(struct notifier_block *self, unsigned long event, void *hcpu)
{
long cpu = (long)hcpu;
+
if (event == CPU_ONLINE) {
struct cpufreq_freqs f = { .cpu = cpu, .new = 0 };
+
on_cpu_single(cpu, resync_freq, &f);
}
return NOTIFY_DONE;
@@ -221,7 +230,6 @@ static __init int init_sched_clock(void)
{
if (unsynchronized_tsc())
no_sc_for_printk = 1;
-
/*
* On a race between the various events the initialization
* might be done multiple times, but code is tolerant to
@@ -231,7 +239,7 @@ static __init int init_sched_clock(void)
CPUFREQ_TRANSITION_NOTIFIER);
hotcpu_notifier(sc_cpu_event, 0);
on_each_cpu(resync_freq_on_cpu, NULL, 0, 0);
+
return 0;
}
core_initcall(init_sched_clock);
-
next prev parent reply other threads:[~2007-05-25 11:50 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 7:10 [patch] sched_clock(): cleanups Ingo Molnar
2007-05-25 7:22 ` Satyam Sharma
2007-05-25 7:25 ` Ingo Molnar
2007-05-25 7:26 ` Ingo Molnar
2007-05-25 7:35 ` Satyam Sharma
2007-05-25 7:39 ` Peter Zijlstra
2007-05-25 7:58 ` Andi Kleen
2007-05-25 8:02 ` Ingo Molnar
2007-05-25 8:16 ` Peter Zijlstra
2007-05-25 8:21 ` Andi Kleen
2007-05-25 7:38 ` Andi Kleen
2007-05-25 7:31 ` Andi Kleen
2007-05-25 7:39 ` Ingo Molnar
2007-05-25 7:43 ` Ingo Molnar
2007-05-25 7:49 ` Ingo Molnar
2007-05-25 7:54 ` [patch] x86_64: fix sched_clock() Ingo Molnar
2007-05-25 8:02 ` Andi Kleen
2007-05-25 8:04 ` Ingo Molnar
2007-05-25 8:20 ` Andi Kleen
2007-05-25 8:34 ` Ingo Molnar
2007-05-25 8:41 ` Andi Kleen
2007-05-25 8:44 ` Ingo Molnar
2007-05-25 8:45 ` Andi Kleen
2007-05-25 8:55 ` Ingo Molnar
2007-05-25 8:55 ` Andrew Morton
2007-05-25 9:03 ` Andi Kleen
2007-05-25 9:19 ` Ingo Molnar
2007-05-25 9:46 ` Andi Kleen
2007-05-25 10:12 ` Ingo Molnar
2007-05-25 11:20 ` Andi Kleen
2007-05-25 11:26 ` Ingo Molnar
2007-05-25 11:31 ` Ingo Molnar
2007-05-25 11:46 ` [patch] sched_clock: fix preempt count imbalance Ingo Molnar
2007-05-25 11:50 ` Ingo Molnar [this message]
2007-05-25 11:55 ` [patch] sched_clock(): cleanups, #2 Andi Kleen
2007-05-25 12:02 ` Ingo Molnar
2007-05-25 12:15 ` Andi Kleen
2007-05-25 16:17 ` Andrew Morton
2007-05-25 16:26 ` Daniel Walker
2007-05-25 16:33 ` Andi Kleen
2007-05-25 16:49 ` Linus Torvalds
2007-05-25 18:08 ` Andi Kleen
2007-05-25 19:14 ` Ingo Molnar
2007-05-25 19:45 ` Linus Torvalds
2007-05-25 10:27 ` [patch] x86_64: fix sched_clock() Ingo Molnar
2007-05-25 11:05 ` Andi Kleen
2007-05-28 3:12 ` Rusty Russell
2007-05-25 8:08 ` [patch] i386, numaq: enable TSCs again Ingo Molnar
2007-05-25 8:19 ` William Lee Irwin III
2007-05-25 8:22 ` Andi Kleen
2007-05-25 8:25 ` William Lee Irwin III
2007-05-25 8:31 ` Ingo Molnar
2007-05-25 8:38 ` William Lee Irwin III
2007-05-25 8:41 ` Ingo Molnar
2007-05-25 18:16 ` Dave Hansen
2007-05-25 18:23 ` john stultz
2007-05-25 8:15 ` [patch] x86_64: fix sched_clock() Peter Zijlstra
2007-05-25 8:16 ` Ingo Molnar
2007-05-25 8:22 ` [patch] sched_clock(): cleanups Peter Zijlstra
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=20070525115004.GA4574@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=satyam.sharma@gmail.com \
--cc=torvalds@linux-foundation.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