From: Michael Wang <wangyun@linux.vnet.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Paul Turner <pjt@google.com>, Dhaval Giani <dhaval.giani@gmail.com>
Subject: [PATCH 1/2] linsched: add the functions for setting scheduler proc parameters
Date: Fri, 27 Apr 2012 15:41:20 +0800 [thread overview]
Message-ID: <4F9A4DA0.7070608@linux.vnet.ibm.com> (raw)
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
reply other threads:[~2012-04-27 7:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4F9A4DA0.7070608@linux.vnet.ibm.com \
--to=wangyun@linux.vnet.ibm.com \
--cc=dhaval.giani@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjt@google.com \
/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 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.