All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] linsched: add the functions for setting scheduler proc parameters
@ 2012-04-27  7:41 Michael Wang
  0 siblings, 0 replies; only message in thread
From: Michael Wang @ 2012-04-27  7:41 UTC (permalink / raw)
  To: LKML; +Cc: Paul Turner, Dhaval Giani

From: Michael Wang <wangyun@linux.vnet.ibm.com>

This patch add the functions for setting scheduler proc parameters.
Currently support:
	sysctl_sched_child_runs_first;
	sysctl_sched_min_granularity;
	sysctl_sched_latency;
	sysctl_sched_wakeup_granularity;

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
---
 arch/linsched/kernel/misc.c     |    3 --
 tools/linsched/Makefile.inc     |    3 +-
 tools/linsched/linsched_proc.c  |   46 +++++++++++++++++++++++++++++++++++++++
 tools/linsched/linsched_proc.h  |    6 +++++
 tools/linsched/linux_linsched.c |    1 +
 5 files changed, 55 insertions(+), 4 deletions(-)
 create mode 100644 tools/linsched/linsched_proc.c
 create mode 100644 tools/linsched/linsched_proc.h

diff --git a/arch/linsched/kernel/misc.c b/arch/linsched/kernel/misc.c
index abb1cb4..a76d397 100644
--- a/arch/linsched/kernel/misc.c
+++ b/arch/linsched/kernel/misc.c
@@ -334,8 +334,5 @@ int proc_dointvec(struct ctl_table *table, int write,
 int proc_dointvec_minmax(struct ctl_table *table, int write,
 		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-	/* should be unused */
-	BUG();
-
 	return 0;
 }
diff --git a/tools/linsched/Makefile.inc b/tools/linsched/Makefile.inc
index 441f7e3..15a344b 100644
--- a/tools/linsched/Makefile.inc
+++ b/tools/linsched/Makefile.inc
@@ -25,7 +25,8 @@ LINSCHED_OBJS = ${LINSCHED_DIR}/linux_linsched.o \
 		${LINSCHED_DIR}/nohz_tracking.o \
 		${LINSCHED_DIR}/linsched_rand.o \
 		${LINSCHED_DIR}/linsched_sim.o \
-		${LINSCHED_DIR}/stubs/sched.o
+		${LINSCHED_DIR}/stubs/sched.o \
+		${LINSCHED_DIR}/linsched_proc.o
 
 LINUX_OBJS =	${LINUXDIR}/kernel/notifier.o \
 		${LINUXDIR}/kernel/timer.o \
diff --git a/tools/linsched/linsched_proc.c b/tools/linsched/linsched_proc.c
new file mode 100644
index 0000000..7731da6
--- /dev/null
+++ b/tools/linsched/linsched_proc.c
@@ -0,0 +1,46 @@
+#include "linsched_proc.h"
+#include "linsched.h"
+
+int min_sched_granularity_ns = 100000;           /* 100 usecs */
+int max_sched_granularity_ns = NSEC_PER_SEC;     /* 1 second */
+
+enum {
+	MIN_GRANULARITY,
+	LATENCY,
+	WAKEUP_GRANULARITY
+};
+
+void linsched_sched_proc_update_handler(int key, unsigned long value)
+{
+	if (value < min_sched_granularity_ns || value > max_sched_granularity_ns)
+		return;
+
+	switch (key) {
+		case MIN_GRANULARITY:
+			sysctl_sched_min_granularity = value;
+			break;
+		case LATENCY:
+			sysctl_sched_latency = value;
+			break;
+		case WAKEUP_GRANULARITY:
+			sysctl_sched_wakeup_granularity = value;
+			break;
+		default:
+			break;
+	}
+        sched_proc_update_handler(NULL,1,NULL,NULL,NULL);
+}
+
+void set_linsched_proc(char *procname, unsigned long value)
+{
+	if (!strcmp(procname, "sched_child_runs_first")) {
+		sysctl_sched_child_runs_first = value;
+	} else if (!strcmp(procname, "sched_min_granularity_ns")) {
+		linsched_sched_proc_update_handler(MIN_GRANULARITY, value);	
+	} else if (!strcmp(procname, "sched_latency_ns")) {
+		linsched_sched_proc_update_handler(LATENCY, value);	
+	} else if (!strcmp(procname, "sched_wakeup_granularity_ns")) {
+		linsched_sched_proc_update_handler(WAKEUP_GRANULARITY, value);	
+	}
+}
+
diff --git a/tools/linsched/linsched_proc.h b/tools/linsched/linsched_proc.h
new file mode 100644
index 0000000..4c27297
--- /dev/null
+++ b/tools/linsched/linsched_proc.h
@@ -0,0 +1,6 @@
+#ifndef LINSCHED_PROC_H
+#define LINSCHED_PROC_H
+
+void set_linsched_proc(char *procname, unsigned long value);
+
+#endif
diff --git a/tools/linsched/linux_linsched.c b/tools/linsched/linux_linsched.c
index ca07a73..6c24578 100644
--- a/tools/linsched/linux_linsched.c
+++ b/tools/linsched/linux_linsched.c
@@ -41,6 +41,7 @@
 
 #include "linsched_rand.h"
 #include "load_balance_score.h"
+#include "linsched_proc.h"
 
 /* linsched variables and functions */
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-27  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27  7:41 [PATCH 1/2] linsched: add the functions for setting scheduler proc parameters Michael Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.