[PATCH] [ppc64] powersave_nap sysctl

Anton Blanchard anton at samba.org
Mon Sep 13 20:56:56 EST 2004


Implement powersave_nap sysctl, like ppc32. This allows us to disable
the nap function which is useful when profiling with oprofile (to get
an accurate count of idle time).

Signed-off-by: Anton Blanchard <anton at samba.org>

diff -puN arch/ppc64/kernel/idle.c~powersave_nap arch/ppc64/kernel/idle.c
--- 2.6.9-rc1-mm5/arch/ppc64/kernel/idle.c~powersave_nap	2004-09-13 19:51:24.809722022 +1000
+++ 2.6.9-rc1-mm5-anton/arch/ppc64/kernel/idle.c	2004-09-13 19:51:24.835720023 +1000
@@ -20,6 +20,8 @@
 #include <linux/kernel.h>
 #include <linux/smp.h>
 #include <linux/cpu.h>
+#include <linux/module.h>
+#include <linux/sysctl.h>
 
 #include <asm/system.h>
 #include <asm/processor.h>
@@ -296,6 +298,38 @@ int cpu_idle(void)
 	return 0;
 }
 
+int powersave_nap;
+
+#ifdef CONFIG_SYSCTL
+/*
+ * Register the sysctl to set/clear powersave_nap.
+ */
+static ctl_table powersave_nap_ctl_table[]={
+	{
+		.ctl_name	= KERN_PPC_POWERSAVE_NAP,
+		.procname	= "powersave-nap",
+		.data		= &powersave_nap,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{ 0, },
+};
+static ctl_table powersave_nap_sysctl_root[] = {
+	{ 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, },
+ 	{ 0,},
+};
+
+static int __init
+register_powersave_nap_sysctl(void)
+{
+	register_sysctl_table(powersave_nap_sysctl_root, 0);
+
+	return 0;
+}
+__initcall(register_powersave_nap_sysctl);
+#endif
+
 int idle_setup(void)
 {
 #ifdef CONFIG_PPC_ISERIES
diff -puN arch/ppc64/kernel/setup.c~powersave_nap arch/ppc64/kernel/setup.c
--- 2.6.9-rc1-mm5/arch/ppc64/kernel/setup.c~powersave_nap	2004-09-13 19:51:24.815721561 +1000
+++ 2.6.9-rc1-mm5-anton/arch/ppc64/kernel/setup.c	2004-09-13 19:51:24.837719870 +1000
@@ -82,8 +82,6 @@ unsigned long decr_overclock_proc0 = 1;
 unsigned long decr_overclock_set = 0;
 unsigned long decr_overclock_proc0_set = 0;
 
-int powersave_nap;
-
 unsigned char aux_device_present;
 
 #ifdef CONFIG_MAGIC_SYSRQ
_



More information about the Linuxppc64-dev mailing list