From: Sasha Levin <levinsasha928@gmail.com>
To: viro@zeniv.linux.org.uk, rostedt@goodmis.org, fweisbec@gmail.com,
mingo@redhat.com, a.p.zijlstra@chello.nl, paulus@samba.org,
acme@ghostprotocols.net, james.l.morris@oracle.com,
ebiederm@xmission.com, akpm@linux-foundation.org,
tglx@linutronix.de
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-security-module@vger.kernel.org,
Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 02/14] sched debug,sysctl: remove proc input checks out of sysctl handlers
Date: Sun, 29 Apr 2012 08:45:25 +0200 [thread overview]
Message-ID: <1335681937-3715-2-git-send-email-levinsasha928@gmail.com> (raw)
In-Reply-To: <1335681937-3715-1-git-send-email-levinsasha928@gmail.com>
Simplify sysctl handler by removing user input checks and using the callback
provided by the sysctl table.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
include/linux/sched.h | 4 +---
kernel/sched/fair.c | 8 +-------
kernel/sysctl.c | 12 ++++++++----
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7d2acbd..722da9a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2136,9 +2136,7 @@ extern unsigned int sysctl_sched_time_avg;
extern unsigned int sysctl_timer_migration;
extern unsigned int sysctl_sched_shares_window;
-int sched_proc_update_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length,
- loff_t *ppos);
+int sched_proc_update_handler(void);
#endif
#ifdef CONFIG_SCHED_DEBUG
static inline unsigned int get_sysctl_timer_migration(void)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e955364..20ccdc8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -558,16 +558,10 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
* Scheduling class statistics methods:
*/
-int sched_proc_update_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+int sched_proc_update_handler(void)
{
- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
int factor = get_update_sysctl_factor();
- if (ret || !write)
- return ret;
-
sched_nr_latency = DIV_ROUND_UP(sysctl_sched_latency,
sysctl_sched_min_granularity);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ba133ec..23f1ac6 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -269,7 +269,8 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_min_granularity,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = sched_proc_update_handler,
+ .proc_handler = proc_dointvec_minmax,
+ .callback = sched_proc_update_handler,
.extra1 = &min_sched_granularity_ns,
.extra2 = &max_sched_granularity_ns,
},
@@ -278,7 +279,8 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_latency,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = sched_proc_update_handler,
+ .proc_handler = proc_dointvec_minmax,
+ .callback = sched_proc_update_handler,
.extra1 = &min_sched_granularity_ns,
.extra2 = &max_sched_granularity_ns,
},
@@ -287,7 +289,8 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_wakeup_granularity,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = sched_proc_update_handler,
+ .proc_handler = proc_dointvec_minmax,
+ .callback = sched_proc_update_handler,
.extra1 = &min_wakeup_granularity_ns,
.extra2 = &max_wakeup_granularity_ns,
},
@@ -296,7 +299,8 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_tunable_scaling,
.maxlen = sizeof(enum sched_tunable_scaling),
.mode = 0644,
- .proc_handler = sched_proc_update_handler,
+ .proc_handler = proc_dointvec_minmax,
+ .callback = sched_proc_update_handler,
.extra1 = &min_sched_tunable_scaling,
.extra2 = &max_sched_tunable_scaling,
},
--
1.7.8.5
next prev parent reply other threads:[~2012-04-29 6:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-29 6:45 [PATCH 01/14] sysctl: provide callback for write into ctl_table entry Sasha Levin
2012-04-29 6:45 ` Sasha Levin [this message]
2012-04-29 6:45 ` [PATCH 03/14] sched rt,sysctl: remove proc input checks out of sysctl handlers Sasha Levin
2012-04-30 2:32 ` Eric Paris
2012-04-29 6:45 ` [PATCH 04/14] ftrace,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 05/14] sysrq,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 06/14] watchdog,sysctl: remove unused external Sasha Levin
2012-04-29 6:45 ` [PATCH 07/14] watchdog,sysctl: remove proc input checks out of sysctl handlers Sasha Levin
2012-04-29 6:45 ` [PATCH 08/14] hung task,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 09/14] perf,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 10/14] mm,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 11/14] hugetlb,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 12/14] mm compaction,sysctl: " Sasha Levin
2012-04-29 6:45 ` [PATCH 13/14] security,sysctl: " Sasha Levin
2012-04-30 2:28 ` Eric Paris
2012-04-29 6:45 ` [PATCH 14/14] fs,sysctl: " Sasha Levin
2012-04-29 8:22 ` [PATCH 01/14] sysctl: provide callback for write into ctl_table entry Eric W. Biederman
2012-04-29 12:07 ` Sasha Levin
2012-04-29 14:00 ` Steven Rostedt
2012-04-29 14:14 ` Sasha Levin
2012-04-29 19:57 ` Steven Rostedt
2012-04-30 2:52 ` Eric W. Biederman
2012-04-29 12:26 ` Sasha Levin
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=1335681937-3715-2-git-send-email-levinsasha928@gmail.com \
--to=levinsasha928@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=fweisbec@gmail.com \
--cc=james.l.morris@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).