mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kurt Garloff <garloff@suse.de>
To: Christoph Hellwig <hch@infradead.org>,
	Linux kernel list <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: Re: dynamic sched timeslices
Date: Tue, 16 Mar 2004 00:09:50 +0100	[thread overview]
Message-ID: <20040315230950.GB4452@tpkurt.garloff.de> (raw)
In-Reply-To: <20040315225939.A23686@infradead.org>


[-- Attachment #1.1: Type: text/plain, Size: 665 bytes --]

Hi Christoph,

quick response!
On Mon, Mar 15, 2004 at 10:59:39PM +0000, Christoph Hellwig wrote:
> Remove the silly desktop boot parameter and the patch looks basically
> okay to me.

See attachment.

> I remember we had a more complete patch to allow tuning the scheduler
> through sysctls in -mm once, though.  Questions is why that one wasn't
> merged and if the same reasons apply to a 'light' version.

Hmm, I fail to remember unfortunately. Probably it had too many knobs.
Andrew?

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)

[-- Attachment #1.2: dynamic-timeslice-2.diff --]
[-- Type: text/plain, Size: 3366 bytes --]

diff -uNr linux-2.6.4/include/linux/sched.h linux-2.6.4.dyn-timeslice/include/linux/sched.h
--- linux-2.6.4/include/linux/sched.h	2004-03-16 00:03:52.000000000 +0100
+++ linux-2.6.4.dyn-timeslice/include/linux/sched.h	2004-03-16 00:05:14.000000000 +0100
@@ -176,6 +176,7 @@
 #define	MAX_SCHEDULE_TIMEOUT	LONG_MAX
 extern signed long FASTCALL(schedule_timeout(signed long timeout));
 asmlinkage void schedule(void);
+extern int max_timeslice, min_timeslice;
 
 struct namespace;
 
diff -uNr linux-2.6.4/include/linux/sysctl.h linux-2.6.4.dyn-timeslice/include/linux/sysctl.h
--- linux-2.6.4/include/linux/sysctl.h	2004-03-16 00:03:52.000000000 +0100
+++ linux-2.6.4.dyn-timeslice/include/linux/sysctl.h	2004-03-16 00:07:31.000000000 +0100
@@ -134,6 +134,9 @@
 	KERN_KDB=64,		/* int: kdb on/off */
 	KERN_S390_HZ_TIMER=65,  /* int: hz timer on or off */
 	KERN_DUMP=66,		/* directory: dump parameters */
+	KERN_MAXTIMESLICE=67,	/* int: nice -20 max timeslice */
+	KERN_MINTIMESLICE=68,	/* int: nice +19 min timeslice */
+	KERN_HZ=69,		/* unsigned long: internal kernel HZ */
 };
 
 
diff -uNr linux-2.6.4/kernel/sched.c linux-2.6.4.dyn-timeslice/kernel/sched.c
--- linux-2.6.4/kernel/sched.c	2004-03-16 00:03:52.000000000 +0100
+++ linux-2.6.4.dyn-timeslice/kernel/sched.c	2004-03-16 00:06:14.000000000 +0100
@@ -79,12 +79,17 @@
 /*
  * These are the 'tuning knobs' of the scheduler:
  *
- * Minimum timeslice is 10 msecs, default timeslice is 100 msecs,
- * maximum timeslice is 200 msecs. Timeslices get refilled after
- * they expire.
- */
-#define MIN_TIMESLICE		( 10 * HZ / 1000)
-#define MAX_TIMESLICE		(200 * HZ / 1000)
+ * Minimum timeslice is 10 msecs, default timeslice is 150 msecs,
+ * maximum timeslice is 300 msecs. Timeslices get refilled after
+ * they expire. 
+ */
+#define __MIN_TIMESLICE		  10000
+#define __MAX_TIMESLICE		 300000
+/* the sysctl values are exported in usec units to userspace */
+int max_timeslice = __MAX_TIMESLICE, min_timeslice = __MIN_TIMESLICE;
+#define MAX_TIMESLICE ((max_timeslice * HZ + 999999) / 1000000)
+#define MIN_TIMESLICE ((min_timeslice * HZ + 999999) / 1000000)
+
 #define ON_RUNQUEUE_WEIGHT	 30
 #define CHILD_PENALTY		 95
 #define PARENT_PENALTY		100
diff -uNr linux-2.6.4/kernel/sysctl.c linux-2.6.4.dyn-timeslice/kernel/sysctl.c
--- linux-2.6.4/kernel/sysctl.c	2004-03-16 00:03:52.000000000 +0100
+++ linux-2.6.4.dyn-timeslice/kernel/sysctl.c	2004-03-16 00:05:14.000000000 +0100
@@ -167,6 +167,7 @@
 static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
 #endif
 
+static unsigned long __HZ = HZ;
 /* The default sysctl tables: */
 
 static ctl_table root_table[] = {
@@ -642,6 +643,30 @@
 		.mode		= 0444,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= KERN_MAXTIMESLICE, 
+		.procname	= "max-timeslice",
+		.data		=  &max_timeslice,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= KERN_MINTIMESLICE, 
+		.procname	= "min-timeslice",
+		.data		= &min_timeslice,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= KERN_HZ, 
+		.procname	= "HZ",
+		.data		= &__HZ,
+		.maxlen		= sizeof(long),
+		.mode		= 0444,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-03-15 23:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 22:42 Kurt Garloff
2004-03-15 22:59 ` Christoph Hellwig
2004-03-15 23:09   ` Kurt Garloff [this message]
2004-03-15 23:40     ` Andrew Morton
2004-03-16 11:36       ` Kurt Garloff
2004-03-16 13:13         ` Con Kolivas
2004-03-16 14:29           ` Kurt Garloff
2004-03-16 20:45             ` Con Kolivas
2004-03-18  0:20               ` Kurt Garloff
2004-03-18  0:32                 ` Andrew Morton
2004-03-18  3:38                   ` Con Kolivas
2004-03-16 15:03 ` Timothy Miller
2004-03-16 15:08   ` Kurt Garloff
2004-03-23  9:23 ` Pavel Machek

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=20040315230950.GB4452@tpkurt.garloff.de \
    --to=garloff@suse.de \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.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®