2006-03-17 21:08:21

by Ravikiran G Thirumalai

[permalink] [raw]
Subject: [patch] Mark cyc2ns_scale readmostly

This variable is rarely written to. Mark the variable accordingly

Signed-off-by: Ravikiran Thirumalai <[email protected]>
Signed-off-by: Shai Fultheim <[email protected]>

Index: linux-2.6.16-rc6mm1/arch/i386/kernel/tsc.c
===================================================================
--- linux-2.6.16-rc6mm1.orig/arch/i386/kernel/tsc.c 2006-03-17 11:18:53.000000000 -0800
+++ linux-2.6.16-rc6mm1/arch/i386/kernel/tsc.c 2006-03-17 11:26:35.000000000 -0800
@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
*
* [email protected] "math is hard, lets go shopping!"
*/
-static unsigned long cyc2ns_scale;
+static unsigned long cyc2ns_scale __read_mostly;

#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

Index: linux-2.6.16-rc6mm1/arch/x86_64/kernel/time.c
===================================================================
--- linux-2.6.16-rc6mm1.orig/arch/x86_64/kernel/time.c 2006-03-17 11:18:53.000000000 -0800
+++ linux-2.6.16-rc6mm1/arch/x86_64/kernel/time.c 2006-03-17 11:23:07.000000000 -0800
@@ -467,7 +467,7 @@ static irqreturn_t timer_interrupt(int i
return IRQ_HANDLED;
}

-static unsigned int cyc2ns_scale;
+static unsigned int cyc2ns_scale __read_mostly;
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

static inline void set_cyc2ns_scale(unsigned long cpu_khz)


2006-03-18 05:39:03

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch] Mark cyc2ns_scale readmostly

Ravikiran G Thirumalai <[email protected]> wrote:
>
> This variable is rarely written to. Mark the variable accordingly
>

I dropped all John's timekeeping patches today - he's redoing everything.
So I've reworked this against mainline.

x86 actually has two cyc2ns_scale's.

arch/i386/kernel/timers/timer_hpet.c | 2 +-
arch/i386/kernel/timers/timer_tsc.c | 2 +-
arch/x86_64/kernel/time.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff -puN arch/i386/kernel/timers/timer_hpet.c~mark-cyc2ns_scale-readmostly arch/i386/kernel/timers/timer_hpet.c
--- devel/arch/i386/kernel/timers/timer_hpet.c~mark-cyc2ns_scale-readmostly 2006-03-17 21:34:19.000000000 -0800
+++ devel-akpm/arch/i386/kernel/timers/timer_hpet.c 2006-03-17 21:34:19.000000000 -0800
@@ -46,7 +46,7 @@ static seqlock_t monotonic_lock = SEQLOC
*
* [email protected] "math is hard, lets go shopping!"
*/
-static unsigned long cyc2ns_scale;
+static unsigned long cyc2ns_scale __read_mostly;
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

static inline void set_cyc2ns_scale(unsigned long cpu_khz)
diff -puN arch/i386/kernel/timers/timer_tsc.c~mark-cyc2ns_scale-readmostly arch/i386/kernel/timers/timer_tsc.c
--- devel/arch/i386/kernel/timers/timer_tsc.c~mark-cyc2ns_scale-readmostly 2006-03-17 21:34:19.000000000 -0800
+++ devel-akpm/arch/i386/kernel/timers/timer_tsc.c 2006-03-17 21:34:19.000000000 -0800
@@ -74,7 +74,7 @@ late_initcall(start_lost_tick_compensati
*
* [email protected] "math is hard, lets go shopping!"
*/
-static unsigned long cyc2ns_scale;
+static unsigned long cyc2ns_scale __read_mostly;
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

static inline void set_cyc2ns_scale(unsigned long cpu_khz)
diff -puN arch/x86_64/kernel/time.c~mark-cyc2ns_scale-readmostly arch/x86_64/kernel/time.c
--- devel/arch/x86_64/kernel/time.c~mark-cyc2ns_scale-readmostly 2006-03-17 21:34:19.000000000 -0800
+++ devel-akpm/arch/x86_64/kernel/time.c 2006-03-17 21:34:19.000000000 -0800
@@ -477,7 +477,7 @@ static irqreturn_t timer_interrupt(int i
return IRQ_HANDLED;
}

-static unsigned int cyc2ns_scale;
+static unsigned int cyc2ns_scale __read_mostly;
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

static inline void set_cyc2ns_scale(unsigned long cpu_khz)
_