this time compile tested on all 16 combinations of: CONFIG_SMP CONFIG_FAIR_GROUP_SCHED CONFIG_HIGH_RES_TIMERS CONFIG_NO_HZ ran some but not all combinations -- --
The list of open points and issues for this work: - review/testing - handle the PI case better The only thing I can come up with currently is to basically have two priority arrays one for boosted and one for non boosted tasks, and normally run the highest of either array, but in the case of a throttled group, only pick from the boosted array. Not sure I like that for its space overhead, Steven? - I occasionally see a weird lockup on iterating the task_groups list on smp machines. - I failed to see anything wrong, but hey, this stack of used brown paper bags is steadily growing. - figure out what to do for UID based group scheduling, the current implementation leaves it impossible for !root users to execute real time tasks by setting rt_runtime_us to 0, and it has no way to change it. Srivatsa, what happened to the per uid weight patches?, Perhaps we can extend that interface to allow changing this. - I guess documentation needs to be written ;-)
Hi Peter, The sysfs interface for tweaking each user's share should be in mainline already (sysfs_create_file() in user_kobject_create()). This could be extended for your purpose, hopefully in a straightforward manner (you never know that with sysfs :( -- Regards, vatsa --
Ah, I missed that going in. Thanks, I'll give it a go.
Subject: sched: rt-group: add uid-group interface
Extend the /sys/kernel/uids/<uid>/ interface to allow setting
the group's rt_period and rt_runtime.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/sched.h | 4 +-
kernel/user.c | 93 +++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 84 insertions(+), 13 deletions(-)
Index: linux-2.6/include/linux/sched.h
===================================================================
--- linux-2.6.orig/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
@@ -559,7 +559,9 @@ struct user_struct {
struct task_group *tg;
#ifdef CONFIG_SYSFS
struct kset kset;
- struct subsys_attribute user_attr;
+ struct subsys_attribute share_attr;
+ struct subsys_attribute rt_period_attr;
+ struct subsys_attribute rt_runtime_attr;
struct work_struct work;
#endif
#endif
Index: linux-2.6/kernel/user.c
===================================================================
--- linux-2.6.orig/kernel/user.c
+++ linux-2.6/kernel/user.c
@@ -129,7 +129,7 @@ static inline void uids_mutex_unlock(voi
}
/* return cpu shares held by the user */
-static ssize_t cpu_shares_show(struct kset *kset, char *buffer)
+static ssize_t cpu_share_show(struct kset *kset, char *buffer)
{
struct user_struct *up = container_of(kset, struct user_struct, kset);
@@ -137,8 +137,8 @@ static ssize_t cpu_shares_show(struct ks
}
/* modify cpu shares held by the user */
-static ssize_t cpu_shares_store(struct kset *kset, const char *buffer,
- size_t size)
+static ssize_t cpu_share_store(struct kset *kset, const char *buffer,
+ size_t size)
{
struct user_struct *up = container_of(kset, struct user_struct, kset);
unsigned long shares;
@@ -151,12 +151,67 @@ static ssize_t cpu_shares_store(struct k
return (rc ? rc : size);
}
-static void user_attr_init(struct subsys_attribute *sa, char *name, int mode)
+static ssize_t cpu_rt_period_show(struct kset *kset, char *buffer)
...I already have documentation on the todo list, I'll add this file to that list :-)
Care to rebase the patch against -mm, we fixed the mixed-up usage of ksets and kobjects, and this can not apply anymore: http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=blob;f=driver/struct-us... There is also an attribute group now which makes it much easier to add new files. Thanks, Kay --
Ingo, Greg, What would be the easiest way to carry this forward? sched-devel and greg's tree would intersect at this point and leave poor akpm with the resulting mess. Should I just make an incremental patch akpm can carry and push? Or can we base one tree off the other? --
hm, i'd really like to see this tested and go through sched.git. It's only the few sysfs bits which interfere, right? Ingo --
Hi, I was wondering where these changes are right now. I don't see the sysfs interface for rt-group-sched in mainline right now. Thanks, -- regards, Dhaval --
All of the sysfs changes I had are in Linus's tree, so you don't need me anymore :) thanks, greg k-h --
compile tested only attempt at finalizing the interface Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> --- Index: linux-2.6/include/linux/sched.h =================================================================== --- linux-2.6.orig/include/linux/sched.h +++ linux-2.6/include/linux/sched.h @@ -1519,8 +1519,6 @@ extern unsigned int sysctl_sched_child_r extern unsigned int sysctl_sched_features; extern unsigned int sysctl_sched_migration_cost; extern unsigned int sysctl_sched_nr_migrate; -extern unsigned int sysctl_sched_rt_period; -extern unsigned int sysctl_sched_rt_runtime; #if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP) extern unsigned int sysctl_sched_min_bal_int_shares; extern unsigned int sysctl_sched_max_bal_int_shares; @@ -1530,6 +1528,8 @@ int sched_nr_latency_handler(struct ctl_ struct file *file, void __user *buffer, size_t *length, loff_t *ppos); #endif +extern unsigned int sysctl_sched_rt_period; +extern int sysctl_sched_rt_runtime; extern unsigned int sysctl_sched_compat_yield; @@ -2017,8 +2017,8 @@ extern void sched_move_task(struct task_ extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); extern unsigned long sched_group_shares(struct task_group *tg); extern int sched_group_set_rt_runtime(struct task_group *tg, - unsigned long rt_runtime_us); -extern unsigned long sched_group_rt_runtime(struct task_group *tg); + long rt_runtime_us); +extern long sched_group_rt_runtime(struct task_group *tg); extern int sched_group_set_rt_period(struct task_group *tg, unsigned long rt_runtime_us); extern unsigned long sched_group_rt_period(struct task_group *tg); Index: linux-2.6/kernel/sched.c =================================================================== --- linux-2.6.orig/kernel/sched.c +++ linux-2.6/kernel/sched.c @@ -649,13 +649,18 @@ const_debug unsigned int sysctl_sched_nr * period over which we measure rt task cpu usage in us. * default: 1s ...
thanks, applied. This is a really big step forwards in terms of making RT task CPU usage more flexible and more manageable. Ingo --
