[patch] sched_clock(): cleanups, #2

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Friday, May 25, 2007 - 4:50 am

* Ingo Molnar <mingo@elte.hu> wrote:


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);
-
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:10 am)
Re: [patch] sched_clock(): cleanups, Satyam Sharma, (Fri May 25, 12:22 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:25 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:26 am)
Re: [patch] sched_clock(): cleanups, Andi Kleen, (Fri May 25, 12:31 am)
Re: [patch] sched_clock(): cleanups, Satyam Sharma, (Fri May 25, 12:35 am)
Re: [patch] sched_clock(): cleanups, Andi Kleen, (Fri May 25, 12:38 am)
Re: [patch] sched_clock(): cleanups, Peter Zijlstra, (Fri May 25, 12:39 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:39 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:43 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 12:49 am)
[patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 12:54 am)
Re: [patch] sched_clock(): cleanups, Andi Kleen, (Fri May 25, 12:58 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 1:02 am)
Re: [patch] sched_clock(): cleanups, Ingo Molnar, (Fri May 25, 1:02 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 1:04 am)
[patch] i386, numaq: enable TSCs again, Ingo Molnar, (Fri May 25, 1:08 am)
Re: [patch] x86_64: fix sched_clock(), Peter Zijlstra, (Fri May 25, 1:15 am)
Re: [patch] sched_clock(): cleanups, Peter Zijlstra, (Fri May 25, 1:16 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 1:16 am)
Re: [patch] i386, numaq: enable TSCs again, William Lee Irwin III, (Fri May 25, 1:19 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 1:20 am)
Re: [patch] sched_clock(): cleanups, Andi Kleen, (Fri May 25, 1:21 am)
Re: [patch] sched_clock(): cleanups, Peter Zijlstra, (Fri May 25, 1:22 am)
Re: [patch] i386, numaq: enable TSCs again, Andi Kleen, (Fri May 25, 1:22 am)
Re: [patch] i386, numaq: enable TSCs again, William Lee Irwin III, (Fri May 25, 1:25 am)
Re: [patch] i386, numaq: enable TSCs again, Ingo Molnar, (Fri May 25, 1:31 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 1:34 am)
Re: [patch] i386, numaq: enable TSCs again, William Lee Irwin III, (Fri May 25, 1:38 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 1:41 am)
Re: [patch] i386, numaq: enable TSCs again, Ingo Molnar, (Fri May 25, 1:41 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 1:44 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 1:45 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 1:55 am)
Re: [patch] x86_64: fix sched_clock(), Andrew Morton, (Fri May 25, 1:55 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 2:03 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 2:19 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 2:46 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 3:12 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 3:27 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 4:05 am)
Re: [patch] x86_64: fix sched_clock(), Andi Kleen, (Fri May 25, 4:20 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 4:26 am)
Re: [patch] x86_64: fix sched_clock(), Ingo Molnar, (Fri May 25, 4:31 am)
[patch] sched_clock: fix preempt count imbalance, Ingo Molnar, (Fri May 25, 4:46 am)
[patch] sched_clock(): cleanups, #2, Ingo Molnar, (Fri May 25, 4:50 am)
Re: [patch] sched_clock(): cleanups, #2, Andi Kleen, (Fri May 25, 4:55 am)
Re: [patch] sched_clock(): cleanups, #2, Ingo Molnar, (Fri May 25, 5:02 am)
Re: [patch] sched_clock(): cleanups, #2, Andi Kleen, (Fri May 25, 5:15 am)
Re: [patch] sched_clock(): cleanups, #2, Andrew Morton, (Fri May 25, 9:17 am)
Re: [patch] sched_clock(): cleanups, #2, Daniel Walker, (Fri May 25, 9:26 am)
Re: [patch] sched_clock(): cleanups, #2, Andi Kleen, (Fri May 25, 9:33 am)
Re: [patch] sched_clock(): cleanups, #2, Linus Torvalds, (Fri May 25, 9:49 am)
Re: [patch] sched_clock(): cleanups, #2, Andi Kleen, (Fri May 25, 11:08 am)
Re: [patch] i386, numaq: enable TSCs again, Dave Hansen, (Fri May 25, 11:16 am)
Re: [patch] i386, numaq: enable TSCs again, john stultz, (Fri May 25, 11:23 am)
Re: [patch] sched_clock(): cleanups, #2, Ingo Molnar, (Fri May 25, 12:14 pm)
Re: [patch] sched_clock(): cleanups, #2, Linus Torvalds, (Fri May 25, 12:45 pm)
Re: [patch] x86_64: fix sched_clock(), Rusty Russell, (Sun May 27, 8:12 pm)