Skip to contentSkip to conversation

: O(1) 2.5.3-K2 Tuneable Parameters

PATCH New Jack F. Vogel 1 participant 1 message Feb 5, 2002 Proc sysctl

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : O(1) 2.5.3-K2 Tuneable Parameters

Here is the resynch of the tuneable parameters patch to Ingo's current delta for 2.5.3. The 2.4.17 will be forthcoming shortly...

Cheers,

Signature · 4 lines
Jack F. Vogel
IBM  Linux Solutions
[email protected]  (work)
[email protected] (home)
include/linux/sysctl.h +14 -0
diff -Naur linux/include/linux/sysctl.h linux.jfv/include/linux/sysctl.h
@@ -72,6 +72,20 @@
 	BUS_ISA=1		/* ISA */
 };
 
+// Tuneable scheduler names:
+enum
+{
+	MAX_SLICE=1,    /* Timeslice scaling */
+	MIN_SLICE=2,
+	CHILD_PENALTY=3,
+	PARENT_PENALTY=4,
+	EWEIGHT=5,
+	BONUS_RATIO=6,
+	INT_DELTA=7,
+	MAX_SLEEP=8,
+	STARVE_LIM=9
+};
+
 /* CTL_KERN names: */
 enum
 {
kernel/sched.c +24 -0
diff -Naur linux/kernel/sched.c linux.jfv/kernel/sched.c
@@ -55,6 +55,7 @@
  * maximum timeslice is 300 msecs. Timeslices get refilled after
  * they expire.
  */
+#ifdef CONFIG_SCHEDTUNE	// Here just to make patch clean
 #define MIN_TIMESLICE		( 10 * HZ / 1000)
 #define MAX_TIMESLICE		(300 * HZ / 1000)
 #define CHILD_PENALTY		95
@@ -64,6 +65,29 @@
 #define INTERACTIVE_DELTA	2
 #define MAX_SLEEP_AVG		(2*HZ)
 #define STARVATION_LIMIT	(2*HZ)
+#else	// Make parameters tuneable at runtime
+
+int min_timeslice = ( 10 * HZ / 1000);
+int max_timeslice = (300 * HZ / 1000);
+int child_penalty = 95;
+int parent_penalty = 100;
+int exit_weight = 3;
+int prio_bonus_ratio = 25;
+int interactive_delta = 2;
+int max_sleep_avg = (2*HZ);
+int starvation_limit = (2*HZ);
+
+#define MIN_TIMESLICE		(min_timeslice)
+#define MAX_TIMESLICE		(max_timeslice)
+#define CHILD_PENALTY		(child_penalty)
+#define PARENT_PENALTY		(parent_penalty)
+#define EXIT_WEIGHT		(exit_weight)
+#define PRIO_BONUS_RATIO	(prio_bonus_ratio)
+#define INTERACTIVE_DELTA	(interactive_delta)
+#define MAX_SLEEP_AVG		(max_sleep_avg)
+#define STARVATION_LIMIT	(starvation_limit)
+
+#endif
 
 /*
  * If a task is 'interactive' then we reinsert it in the active
kernel/sysctl.c +28 -0
diff -Naur linux/kernel/sysctl.c linux.jfv/kernel/sysctl.c
@@ -52,6 +52,10 @@
 extern int core_uses_pid;
 extern int cad_pid;
 
+extern int min_timeslice, max_timeslice, child_penalty, parent_penalty;
+extern int 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;
@@ -110,6 +114,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
@@ -154,6 +159,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_KERN, "sched", NULL, 0, 0555, sched_table},
 	{0}
 };
 
@@ -275,6 +281,28 @@
 	{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_penalty, sizeof(int), 0644, NULL, &proc_dointvec},
+	{PARENT_PENALTY, "PARENT_FORK_PENALTY",
+	&parent_penalty, sizeof(int), 0644, NULL, &proc_dointvec},
+	{EWEIGHT, "EXIT_WEIGHT",
+	&exit_weight, 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},
+	{MAX_SLEEP, "MAX_SLEEP_AVG",
+	&max_sleep_avg, sizeof(int), 0644, NULL, &proc_dointvec},
+	{STARVE_LIM, "STARVATION_LIMIT",
+	&starvation_limit, sizeof(int), 0644, NULL, &proc_dointvec},
+	{0}
+};
+
 static ctl_table proc_table[] = {
 	{0}
 };