diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2012-02-23 03:41:27 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-03-02 06:23:49 -0500 |
commit | 2e5b5b3a1b7768c89fbfeca18e75f8ee377e924c (patch) | |
tree | 0d6d589e42b7e88464d5edcfa818b3a7e27a93e8 | |
parent | 367456c756a6b84f493ca9cc5b17b1f5d38ef466 (diff) |
sched: Clean up parameter passing of proc_sched_autogroup_set_nice()
Pass nice as a value to proc_sched_autogroup_set_nice().
No side effect is expected, and the variable err will be overwritten with
the return value.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4F45FBB7.5090607@ct.jp.nec.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | fs/proc/base.c | 3 | ||||
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | kernel/sched/auto_group.c | 12 |
3 files changed, 8 insertions, 9 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index d4548dd49b02..965d4bde3a3b 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1310,8 +1310,7 @@ sched_autogroup_write(struct file *file, const char __user *buf, | |||
1310 | if (!p) | 1310 | if (!p) |
1311 | return -ESRCH; | 1311 | return -ESRCH; |
1312 | 1312 | ||
1313 | err = nice; | 1313 | err = proc_sched_autogroup_set_nice(p, nice); |
1314 | err = proc_sched_autogroup_set_nice(p, &err); | ||
1315 | if (err) | 1314 | if (err) |
1316 | count = err; | 1315 | count = err; |
1317 | 1316 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index c628a9151437..c298fb9cf5ad 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2065,7 +2065,7 @@ extern void sched_autogroup_fork(struct signal_struct *sig); | |||
2065 | extern void sched_autogroup_exit(struct signal_struct *sig); | 2065 | extern void sched_autogroup_exit(struct signal_struct *sig); |
2066 | #ifdef CONFIG_PROC_FS | 2066 | #ifdef CONFIG_PROC_FS |
2067 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); | 2067 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); |
2068 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice); | 2068 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice); |
2069 | #endif | 2069 | #endif |
2070 | #else | 2070 | #else |
2071 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } | 2071 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } |
diff --git a/kernel/sched/auto_group.c b/kernel/sched/auto_group.c index e8a1f83ee0e7..0984a21076a3 100644 --- a/kernel/sched/auto_group.c +++ b/kernel/sched/auto_group.c | |||
@@ -195,20 +195,20 @@ __setup("noautogroup", setup_autogroup); | |||
195 | 195 | ||
196 | #ifdef CONFIG_PROC_FS | 196 | #ifdef CONFIG_PROC_FS |
197 | 197 | ||
198 | int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice) | 198 | int proc_sched_autogroup_set_nice(struct task_struct *p, int nice) |
199 | { | 199 | { |
200 | static unsigned long next = INITIAL_JIFFIES; | 200 | static unsigned long next = INITIAL_JIFFIES; |
201 | struct autogroup *ag; | 201 | struct autogroup *ag; |
202 | int err; | 202 | int err; |
203 | 203 | ||
204 | if (*nice < -20 || *nice > 19) | 204 | if (nice < -20 || nice > 19) |
205 | return -EINVAL; | 205 | return -EINVAL; |
206 | 206 | ||
207 | err = security_task_setnice(current, *nice); | 207 | err = security_task_setnice(current, nice); |
208 | if (err) | 208 | if (err) |
209 | return err; | 209 | return err; |
210 | 210 | ||
211 | if (*nice < 0 && !can_nice(current, *nice)) | 211 | if (nice < 0 && !can_nice(current, nice)) |
212 | return -EPERM; | 212 | return -EPERM; |
213 | 213 | ||
214 | /* this is a heavy operation taking global locks.. */ | 214 | /* this is a heavy operation taking global locks.. */ |
@@ -219,9 +219,9 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice) | |||
219 | ag = autogroup_task_get(p); | 219 | ag = autogroup_task_get(p); |
220 | 220 | ||
221 | down_write(&ag->lock); | 221 | down_write(&ag->lock); |
222 | err = sched_group_set_shares(ag->tg, prio_to_weight[*nice + 20]); | 222 | err = sched_group_set_shares(ag->tg, prio_to_weight[nice + 20]); |
223 | if (!err) | 223 | if (!err) |
224 | ag->nice = *nice; | 224 | ag->nice = nice; |
225 | up_write(&ag->lock); | 225 | up_write(&ag->lock); |
226 | 226 | ||
227 | autogroup_kref_put(ag); | 227 | autogroup_kref_put(ag); |