mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kenneth Chen" <kenneth.w.chen@intel.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-ia64@vger.kernel.org>
Subject: add lowpower_idle sysctl
Date: Wed, 17 Mar 2004 16:31:26 -0800	[thread overview]
Message-ID: <200403180031.i2I0VQF02038@unix-os.sc.intel.com> (raw)

On ia64, we need runtime control to manage CPU power state in the idle
loop.  Logically it means a sysctl entry in /proc/sys/kernel.  Even
though this sysctl entry doesn't exist today, lots of arch already has
some sort of API to dynamically enable/disable low power idle state.
Looking at linux-2.6.4, arm, arm26, cris, i386, parisc, sh, um, x86-64
all has very much the same code in each arch.  So instead of replicate
another set under arch/ia64, we are proposing these API to be abstracted
out in the generic code.  And also add a sysctl entry under /proc/sys/kernel.

Would this be useful to all architecture who wants this features?  It
would be a lot less code duplication.

- Ken


diff -Nur linux-2.6.4/include/linux/sysctl.h linux-2.6.4.halt/include/linux/sysctl.h
--- linux-2.6.4/include/linux/sysctl.h	2004-03-10 18:55:28.000000000 -0800
+++ linux-2.6.4.halt/include/linux/sysctl.h	2004-03-17 15:33:30.000000000 -0800
@@ -131,6 +131,7 @@
 	KERN_PRINTK_RATELIMIT_BURST=61,	/* int: tune printk ratelimiting */
 	KERN_PTY=62,		/* dir: pty driver */
 	KERN_NGROUPS_MAX=63,	/* int: NGROUPS_MAX */
+	KERN_LOWPOWER_IDLE=64,	/* int: low power idle */
 };


diff -Nur linux-2.6.4/kernel/cpu.c linux-2.6.4.halt/kernel/cpu.c
--- linux-2.6.4/kernel/cpu.c	2004-03-10 18:55:44.000000000 -0800
+++ linux-2.6.4.halt/kernel/cpu.c	2004-03-17 15:36:32.000000000 -0800
@@ -64,3 +64,15 @@
 	up(&cpucontrol);
 	return ret;
 }
+
+atomic_t halt_counter;
+void enable_halt(void)
+{
+	atomic_dec(&halt_counter);
+}
+void disable_halt(void)
+{
+	atomic_inc(&halt_counter);
+}
+EXPORT_SYMBOL(enable_halt);
+EXPORT_SYMBOL(disable_halt);
diff -Nur linux-2.6.4/kernel/sysctl.c linux-2.6.4.halt/kernel/sysctl.c
--- linux-2.6.4/kernel/sysctl.c	2004-03-10 18:55:22.000000000 -0800
+++ linux-2.6.4.halt/kernel/sysctl.c	2004-03-17 15:34:52.000000000 -0800
@@ -64,6 +64,7 @@
 extern int min_free_kbytes;
 extern int printk_ratelimit_jiffies;
 extern int printk_ratelimit_burst;
+extern atomic_t halt_counter;

 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
@@ -615,6 +616,14 @@
 		.mode		= 0444,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= KERN_LOWPOWER_IDLE,
+		.procname	= "lowpower_idle",
+		.data		= &halt_counter,
+		.maxlen		= sizeof (int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };




             reply	other threads:[~2004-03-18  0:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18  0:31 Kenneth Chen [this message]
2004-03-18  1:04 ` Andrew Morton
2004-03-18  3:18   ` Kenneth Chen
2004-03-18  3:28     ` Andrew Morton
2004-03-18  3:40       ` Zwane Mwaikambo
2004-03-18  9:05         ` Dominik Brodowski
2004-03-18 18:29           ` Kenneth Chen
2004-03-18 22:59         ` Todd Poynor
2004-03-19  0:09           ` Andrew Morton
2004-03-19  0:43           ` Zwane Mwaikambo
2004-03-25 19:20           ` Chen, Kenneth W
2004-03-18 21:59       ` Kenneth Chen
2004-03-18 22:35         ` Andrew Morton
2004-03-24  9:54         ` Pavel Machek
2004-03-25 19:04           ` Chen, Kenneth W
2004-03-18  9:42   ` Pasi Savolainen
2004-03-23  9:56 ` Pavel Machek
2004-03-18  7:49 Ross Dickson

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=200403180031.i2I0VQF02038@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®