diff options
Diffstat (limited to 'kernel/sched_debug.c')
-rw-r--r-- | kernel/sched_debug.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 3e47e870b043..57ee9d5630a8 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -212,6 +212,49 @@ static void sysrq_sched_debug_show(void) | |||
212 | sched_debug_show(NULL, NULL); | 212 | sched_debug_show(NULL, NULL); |
213 | } | 213 | } |
214 | 214 | ||
215 | #ifdef CONFIG_FAIR_USER_SCHED | ||
216 | |||
217 | static DEFINE_MUTEX(root_user_share_mutex); | ||
218 | |||
219 | static int | ||
220 | root_user_share_read_proc(char *page, char **start, off_t off, int count, | ||
221 | int *eof, void *data) | ||
222 | { | ||
223 | int len; | ||
224 | |||
225 | len = sprintf(page, "%d\n", init_task_grp_load); | ||
226 | |||
227 | return len; | ||
228 | } | ||
229 | |||
230 | static int | ||
231 | root_user_share_write_proc(struct file *file, const char __user *buffer, | ||
232 | unsigned long count, void *data) | ||
233 | { | ||
234 | unsigned long shares; | ||
235 | char kbuf[sizeof(unsigned long)+1]; | ||
236 | int rc = 0; | ||
237 | |||
238 | if (copy_from_user(kbuf, buffer, sizeof(kbuf))) | ||
239 | return -EFAULT; | ||
240 | |||
241 | shares = simple_strtoul(kbuf, NULL, 0); | ||
242 | |||
243 | if (!shares) | ||
244 | shares = NICE_0_LOAD; | ||
245 | |||
246 | mutex_lock(&root_user_share_mutex); | ||
247 | |||
248 | init_task_grp_load = shares; | ||
249 | rc = sched_group_set_shares(&init_task_grp, shares); | ||
250 | |||
251 | mutex_unlock(&root_user_share_mutex); | ||
252 | |||
253 | return (rc < 0 ? rc : count); | ||
254 | } | ||
255 | |||
256 | #endif /* CONFIG_FAIR_USER_SCHED */ | ||
257 | |||
215 | static int sched_debug_open(struct inode *inode, struct file *filp) | 258 | static int sched_debug_open(struct inode *inode, struct file *filp) |
216 | { | 259 | { |
217 | return single_open(filp, sched_debug_show, NULL); | 260 | return single_open(filp, sched_debug_show, NULL); |
@@ -234,6 +277,15 @@ static int __init init_sched_debug_procfs(void) | |||
234 | 277 | ||
235 | pe->proc_fops = &sched_debug_fops; | 278 | pe->proc_fops = &sched_debug_fops; |
236 | 279 | ||
280 | #ifdef CONFIG_FAIR_USER_SCHED | ||
281 | pe = create_proc_entry("root_user_share", 0644, NULL); | ||
282 | if (!pe) | ||
283 | return -ENOMEM; | ||
284 | |||
285 | pe->read_proc = root_user_share_read_proc; | ||
286 | pe->write_proc = root_user_share_write_proc; | ||
287 | #endif | ||
288 | |||
237 | return 0; | 289 | return 0; |
238 | } | 290 | } |
239 | 291 | ||