diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2007-10-15 11:00:14 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:14 -0400 |
commit | 5cb350baf580017da38199625b7365b1763d7180 (patch) | |
tree | 3830339798b1c6f19f1580700ea6ba240fb56ef2 /kernel/sched_debug.c | |
parent | 8ca0e14ffb12c257de591571a9e96102acdb1c64 (diff) |
sched: group scheduling, sysfs tunables
Add tunables in sysfs to modify a user's cpu share.
A directory is created in sysfs for each new user in the system.
/sys/kernel/uids/<uid>/cpu_share
Reading this file returns the cpu shares granted for the user.
Writing into this file modifies the cpu share for the user. Only an
administrator is allowed to modify a user's cpu share.
Ex:
# cd /sys/kernel/uids/
# cat 512/cpu_share
1024
# echo 2048 > 512/cpu_share
# cat 512/cpu_share
2048
#
Signed-off-by: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_debug.c')
-rw-r--r-- | kernel/sched_debug.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 6f87b31d233c..0aab455a7b41 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -231,45 +231,6 @@ static void sysrq_sched_debug_show(void) | |||
231 | sched_debug_show(NULL, NULL); | 231 | sched_debug_show(NULL, NULL); |
232 | } | 232 | } |
233 | 233 | ||
234 | #ifdef CONFIG_FAIR_USER_SCHED | ||
235 | |||
236 | static DEFINE_MUTEX(root_user_share_mutex); | ||
237 | |||
238 | static int | ||
239 | root_user_share_read_proc(char *page, char **start, off_t off, int count, | ||
240 | int *eof, void *data) | ||
241 | { | ||
242 | return sprintf(page, "%d\n", init_task_group_load); | ||
243 | } | ||
244 | |||
245 | static int | ||
246 | root_user_share_write_proc(struct file *file, const char __user *buffer, | ||
247 | unsigned long count, void *data) | ||
248 | { | ||
249 | unsigned long shares; | ||
250 | char kbuf[sizeof(unsigned long)+1]; | ||
251 | int rc = 0; | ||
252 | |||
253 | if (copy_from_user(kbuf, buffer, sizeof(kbuf))) | ||
254 | return -EFAULT; | ||
255 | |||
256 | shares = simple_strtoul(kbuf, NULL, 0); | ||
257 | |||
258 | if (!shares) | ||
259 | shares = NICE_0_LOAD; | ||
260 | |||
261 | mutex_lock(&root_user_share_mutex); | ||
262 | |||
263 | init_task_group_load = shares; | ||
264 | rc = sched_group_set_shares(&init_task_group, shares); | ||
265 | |||
266 | mutex_unlock(&root_user_share_mutex); | ||
267 | |||
268 | return (rc < 0 ? rc : count); | ||
269 | } | ||
270 | |||
271 | #endif /* CONFIG_FAIR_USER_SCHED */ | ||
272 | |||
273 | static int sched_debug_open(struct inode *inode, struct file *filp) | 234 | static int sched_debug_open(struct inode *inode, struct file *filp) |
274 | { | 235 | { |
275 | return single_open(filp, sched_debug_show, NULL); | 236 | return single_open(filp, sched_debug_show, NULL); |
@@ -292,15 +253,6 @@ static int __init init_sched_debug_procfs(void) | |||
292 | 253 | ||
293 | pe->proc_fops = &sched_debug_fops; | 254 | pe->proc_fops = &sched_debug_fops; |
294 | 255 | ||
295 | #ifdef CONFIG_FAIR_USER_SCHED | ||
296 | pe = create_proc_entry("root_user_cpu_share", 0644, NULL); | ||
297 | if (!pe) | ||
298 | return -ENOMEM; | ||
299 | |||
300 | pe->read_proc = root_user_share_read_proc; | ||
301 | pe->write_proc = root_user_share_write_proc; | ||
302 | #endif | ||
303 | |||
304 | return 0; | 256 | return 0; |
305 | } | 257 | } |
306 | 258 | ||