public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jack F. Vogel" <jfv@trane.bluesong.net>
To: Ingo Molnar <mingo@elte.hu>, jfv@us.ibm.com
Cc: linux-kernel@vger.kernel.org, jstultz@us.ibm.com
Subject: [PATCH]: O(1) 2.4.17-J7 Tuneable Parameters
Date: Fri, 25 Jan 2002 23:12:57 -0800	[thread overview]
Message-ID: <200201260712.g0Q7CwN20290@Bluesong.NET> (raw)

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hi Ingo,

	This patch synchronizes with J7 and I think makes the changes
you wished. A couple of important points:

		- This patch can be applied to EITHER 2.4.17 OR 2.4.18 pre 7 as
			long as Ingo's J7 patch is applied first.

		- While I agree with you on not wanting these in the mainline kernel,
			I ran Hackbench on one of our new Foster systems with and
			without the tuneable parameters, and while the numbers do
			degrade slightly, its rather suprisingly small. So dont be afraid
			to use this as a system tuning aid.

-- 
Jack F. Vogel
IBM  Linux Solutions
jfv@us.ibm.com  (work)
jfv@Bluesong.NET (home)


[-- Attachment #2: Tuneable Scheduler Parameters for O(1) J7 --]
[-- Type: text/x-diff, Size: 6206 bytes --]

diff -Naur linux/include/linux/sched.h linux.jfv/include/linux/sched.h
--- linux/include/linux/sched.h	Fri Jan 25 17:31:12 2002
+++ linux.jfv/include/linux/sched.h	Fri Jan 25 15:27:13 2002
@@ -472,20 +472,37 @@
 #define DEF_USER_NICE		0
 
 /*
- * Default timeslice is 250 msecs, maximum is 500 msecs.
+ * Default timeslice is now HZ, maximum is 300 msecs.
  * Minimum timeslice is 10 msecs.
  */
-#define MIN_TIMESLICE		( 10 * HZ / 1000)
-#define MAX_TIMESLICE           (300 * HZ / 1000)
-#define CHILD_FORK_PENALTY      95
-#define PARENT_FORK_PENALTY     100
-#define EXIT_WEIGHT             3
-#define PRIO_INTERACTIVE_RATIO  20
-#define PRIO_CPU_HOG_RATIO      60
-#define PRIO_BONUS_RATIO        70
-#define INTERACTIVE_DELTA       3
-#define MAX_SLEEP_AVG           (2*HZ)
-#define STARVATION_LIMIT        (2*HZ)
+#define DEFAULT_MIN_TIMESLICE		( 10 * HZ / 1000)
+#define DEFAULT_MAX_TIMESLICE           (300 * HZ / 1000)
+#define DEFAULT_CHILD_FORK_PENALTY      95
+#define DEFAULT_PARENT_FORK_PENALTY     100
+#define DEFAULT_EXIT_WEIGHT             3
+#define DEFAULT_PRIO_INTERACTIVE_RATIO  20
+#define DEFAULT_PRIO_CPU_HOG_RATIO      60
+#define DEFAULT_PRIO_BONUS_RATIO        70
+#define DEFAULT_INTERACTIVE_DELTA       3
+#define DEFAULT_MAX_SLEEP_AVG           (2*HZ)
+#define DEFAULT_STARVATION_LIMIT        (2*HZ)
+
+extern int min_timeslice, max_timeslice, child_fork_penalty;
+extern int parent_fork_penalty, prio_cpu_hog_ratio, prio_bonus_ratio;
+extern int exit_weight, prio_bonus_ratio, interactive_delta;
+extern int max_sleep_avg, starvation_limit;
+
+#define MIN_TIMESLICE           (min_timeslice)
+#define MAX_TIMESLICE           (max_timeslice)
+#define CHILD_FORK_PENALTY      (child_fork_penalty)
+#define PARENT_FORK_PENALTY     (parent_fork_penalty)
+#define PRIO_INTERACTIVE_RATIO  (prio_interactive_ratio)
+#define PRIO_CPU_HOG_RATIO      (prio_cpu_hog_ratio)
+#define PRIO_BONUS_RATIO        (prio_bonus_ratio)
+#define INTERACTIVE_DELTA       (interactive_delta)
+#define EXIT_WEIGHT             (exit_weight)
+#define MAX_SLEEP_AVG           (max_sleep_avg)
+#define STARVATION_LIMIT        (starvation_limit)
 
 #define USER_PRIO(p)		((p)-MAX_RT_PRIO)
 #define MAX_USER_PRIO		(USER_PRIO(MAX_PRIO))
diff -Naur linux/include/linux/sysctl.h linux.jfv/include/linux/sysctl.h
--- linux/include/linux/sysctl.h	Mon Nov 26 05:29:17 2001
+++ linux.jfv/include/linux/sysctl.h	Fri Jan 25 15:28:28 2002
@@ -63,7 +63,8 @@
 	CTL_DEV=7,		/* Devices */
 	CTL_BUS=8,		/* Busses */
 	CTL_ABI=9,		/* Binary emulation */
-	CTL_CPU=10		/* CPU stuff (speed scaling, etc) */
+	CTL_CPU=10,		/* CPU stuff (speed scaling, etc) */
+	CTL_SCHED=11		/* SCHED ctl (tuneable parameters) */
 };
 
 /* CTL_BUS names: */
@@ -72,6 +73,22 @@
 	BUS_ISA=1		/* ISA */
 };
 
+/* CTL_SCHED names: */
+enum
+{
+	MAX_SLICE=1,	/* Timeslice scaling */
+	MIN_SLICE=2,
+	CHILD_PENALTY=3,
+	PARENT_PENALTY=4,
+	INT_RATIO=5,
+	HOG_RATIO=6,
+	BONUS_RATIO=7,
+	INT_DELTA=8,
+	EWEIGHT=9,
+	MAX_SLEEP=10,
+	STARVE_LIM=11
+};
+
 /* CTL_KERN names: */
 enum
 {
diff -Naur linux/kernel/sched.c linux.jfv/kernel/sched.c
--- linux/kernel/sched.c	Fri Jan 25 17:31:12 2002
+++ linux.jfv/kernel/sched.c	Fri Jan 25 15:22:40 2002
@@ -22,6 +22,22 @@
 
 #define BITMAP_SIZE ((((MAX_PRIO+7)/8)+sizeof(long)-1)/sizeof(long))
 
+/*
+**	Tuneable scheduler parameters,
+**	brought out in /proc/sys/sched
+*/
+int	max_timeslice = DEFAULT_MAX_TIMESLICE;
+int	min_timeslice = DEFAULT_MIN_TIMESLICE;
+int	child_fork_penalty = DEFAULT_CHILD_FORK_PENALTY;
+int	parent_fork_penalty = DEFAULT_PARENT_FORK_PENALTY;
+int	prio_interactive_ratio = DEFAULT_PRIO_INTERACTIVE_RATIO;
+int	prio_cpu_hog_ratio = DEFAULT_PRIO_CPU_HOG_RATIO;
+int	prio_bonus_ratio = DEFAULT_PRIO_BONUS_RATIO;
+int	interactive_delta = DEFAULT_INTERACTIVE_DELTA;
+int	exit_weight = DEFAULT_EXIT_WEIGHT;
+int	max_sleep_avg = DEFAULT_MAX_SLEEP_AVG;
+int	starvation_limit = DEFAULT_STARVATION_LIMIT;
+
 typedef struct runqueue runqueue_t;
 
 struct prio_array {
diff -Naur linux/kernel/sysctl.c linux.jfv/kernel/sysctl.c
--- linux/kernel/sysctl.c	Fri Dec 21 09:42:04 2001
+++ linux.jfv/kernel/sysctl.c	Fri Jan 25 17:10:33 2002
@@ -50,7 +50,9 @@
 extern int sysrq_enabled;
 extern int core_uses_pid;
 extern int cad_pid;
-
+extern int child_fork_penalty, parent_fork_penalty,prio_interactive_ratio;
+extern int prio_cpu_hog_ratio, prio_bonus_ratio, interactive_delta;
+extern int exit_weight, max_sleep_avg, starvation_limit;
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid;
@@ -109,6 +111,7 @@
 
 static ctl_table kern_table[];
 static ctl_table vm_table[];
+static ctl_table sched_table[];
 #ifdef CONFIG_NET
 extern ctl_table net_table[];
 #endif
@@ -153,6 +156,7 @@
 	{CTL_FS, "fs", NULL, 0, 0555, fs_table},
 	{CTL_DEBUG, "debug", NULL, 0, 0555, debug_table},
         {CTL_DEV, "dev", NULL, 0, 0555, dev_table},
+        {CTL_SCHED, "sched", NULL, 0, 0555, sched_table},
 	{0}
 };
 
@@ -278,6 +282,33 @@
 	{0}
 };
 
+
+static ctl_table sched_table[] = {
+	{MAX_SLICE, "MAX_TIMESLICE",
+	&max_timeslice, sizeof(int), 0644, NULL, &proc_dointvec},
+	{MIN_SLICE, "MIN_TIMESLICE",
+	&min_timeslice, sizeof(int), 0644, NULL, &proc_dointvec},
+	{CHILD_PENALTY, "CHILD_FORK_PENALTY",
+	&child_fork_penalty, sizeof(int), 0644, NULL, &proc_dointvec},
+	{PARENT_PENALTY, "PARENT_FORK_PENALTY",
+	&parent_fork_penalty, sizeof(int), 0644, NULL, &proc_dointvec},
+	{INT_RATIO, "PRIO_INTERACTIVE_RATIO",
+	&prio_interactive_ratio, sizeof(int), 0644, NULL, &proc_dointvec},
+	{HOG_RATIO, "PRIO_CPU_HOG_RATIO",
+	&prio_cpu_hog_ratio, sizeof(int), 0644, NULL, &proc_dointvec},
+	{BONUS_RATIO, "PRIO_BONUS_RATIO",
+	&prio_bonus_ratio, sizeof(int), 0644, NULL, &proc_dointvec},
+	{INT_DELTA, "INTERACTIVE_DELTA",
+	&interactive_delta, sizeof(int), 0644, NULL, &proc_dointvec},
+	{EWEIGHT, "EXIT_WEIGHT",
+	&exit_weight, sizeof(int), 0644, NULL, &proc_dointvec},
+	{MAX_SLEEP, "MAX_SLEEP_AVG",
+	&max_sleep_avg, sizeof(int), 0644, NULL, &proc_dointvec},
+	{STARVE_LIM, "INTERACTIVE_DELTA",
+	&starvation_limit, sizeof(int), 0644, NULL, &proc_dointvec},
+	{0}
+};
+
 static ctl_table proc_table[] = {
 	{0}
 };

             reply	other threads:[~2002-01-26  7:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-26  7:12 Jack F. Vogel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-01-30 13:21 [PATCH]: O(1) 2.4.17-J7 Tuneable Parameters Martin Knoblauch
2002-01-30 21:05 ` Rob Landley
2002-01-31  1:44 ` Jack F. Vogel

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=200201260712.g0Q7CwN20290@Bluesong.NET \
    --to=jfv@trane.bluesong.net \
    --cc=jfv@bluesong.net \
    --cc=jfv@us.ibm.com \
    --cc=jstultz@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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