mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] -mm: acpi idle __read_mostly and de-init static var
@ 2006-04-18 19:00 Andreas Mohr
  2006-04-19  6:30 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Mohr @ 2006-04-18 19:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-acpi, Dominik Brodowski, linux-kernel

Hello all,

- make pm_idle_save, nocst and bm_history __read_mostly
- static first_run is initialized to 0 by default already
- don't remove static init value of nocst and bm_history
  since __read_mostly may be special
  (see e.g. http://www.ussg.iu.edu/hypermail/linux/kernel/0010.0/0771.html)

Patch tested on 2.6.17-rc1-mm2, rediffed against 2.6.17-rc1-mm3.

Signed-off-by: Andreas Mohr <andi@lisas.de>


diff -urN linux-2.6.17-rc1-mm3.orig/drivers/acpi/processor_idle.c linux-2.6.17-rc1-mm3/drivers/acpi/processor_idle.c
--- linux-2.6.17-rc1-mm3.orig/drivers/acpi/processor_idle.c	2006-04-18 20:06:57.000000000 +0200
+++ linux-2.6.17-rc1-mm3/drivers/acpi/processor_idle.c	2006-04-18 20:11:16.000000000 +0200
@@ -54,10 +54,10 @@
 #define US_TO_PM_TIMER_TICKS(t)		((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
 #define C2_OVERHEAD			4	/* 1us (3.579 ticks per us) */
 #define C3_OVERHEAD			4	/* 1us (3.579 ticks per us) */
-static void (*pm_idle_save) (void);
+static void (*pm_idle_save) (void) __read_mostly;
 module_param(max_cstate, uint, 0644);
 
-static unsigned int nocst = 0;
+static unsigned int nocst __read_mostly = 0;
 module_param(nocst, uint, 0000);
 
 /*
@@ -67,7 +67,7 @@
  * 100 HZ: 0x0000000F: 4 jiffies = 40ms
  * reduce history for more aggressive entry into C3
  */
-static unsigned int bm_history =
+static unsigned int bm_history __read_mostly =
     (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
 module_param(bm_history, uint, 0644);
 /* --------------------------------------------------------------------------
@@ -1088,7 +1088,7 @@
 			      struct acpi_device *device)
 {
 	acpi_status status = 0;
-	static int first_run = 0;
+	static int first_run; /* static: = 0 */
 	struct proc_dir_entry *entry = NULL;
 	unsigned int i;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] -mm: acpi idle __read_mostly and de-init static var
  2006-04-18 19:00 [PATCH] -mm: acpi idle __read_mostly and de-init static var Andreas Mohr
@ 2006-04-19  6:30 ` Andrew Morton
  2006-04-19 10:01   ` Roman Zippel
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-04-19  6:30 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: linux-acpi, linux, linux-kernel, Roman Zippel

Andreas Mohr <andi@rhlx01.fht-esslingen.de> wrote:
>
> - don't remove static init value of nocst and bm_history
>    since __read_mostly may be special
>    (see e.g. http://www.ussg.iu.edu/hypermail/linux/kernel/0010.0/0771.html)
> 

hm, that was six years ago.  I'm vaguely surprised that the initialisation
was needed even then.  It isn't needed now.  Or if it is, we need to find
out why and fix it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] -mm: acpi idle __read_mostly and de-init static var
  2006-04-19  6:30 ` Andrew Morton
@ 2006-04-19 10:01   ` Roman Zippel
  0 siblings, 0 replies; 3+ messages in thread
From: Roman Zippel @ 2006-04-19 10:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andreas Mohr, linux-acpi, linux, linux-kernel

Hi,

On Tue, 18 Apr 2006, Andrew Morton wrote:

> Andreas Mohr <andi@rhlx01.fht-esslingen.de> wrote:
> >
> > - don't remove static init value of nocst and bm_history
> >    since __read_mostly may be special
> >    (see e.g. http://www.ussg.iu.edu/hypermail/linux/kernel/0010.0/0771.html)
> > 
> 
> hm, that was six years ago.  I'm vaguely surprised that the initialisation
> was needed even then.  It isn't needed now.  Or if it is, we need to find
> out why and fix it.

I guess 2.7.2 was still a valid compiler then. :)
All later versions don't behave like this, although it's still documented 
like this: http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html

bye, Roman

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-19 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-18 19:00 [PATCH] -mm: acpi idle __read_mostly and de-init static var Andreas Mohr
2006-04-19  6:30 ` Andrew Morton
2006-04-19 10:01   ` Roman Zippel

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®