diff options
author | Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> | 2007-10-15 11:00:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:09 -0400 |
commit | 24e377a83220ef05c9b5bec7e01d65eed6609aa6 (patch) | |
tree | 9303b3d9f91ee39517d379aaac06c0432be8a9b8 /kernel/sched.c | |
parent | 9b5b77512dce239fa168183fa71896712232e95a (diff) |
sched: add fair-user scheduler
Enable user-id based fair group scheduling. This is useful for anyone
who wants to test the group scheduler w/o having to enable
CONFIG_CGROUPS.
A separate scheduling group (i.e struct task_grp) is automatically created for
every new user added to the system. Upon uid change for a task, it is made to
move to the corresponding scheduling group.
A /proc tunable (/proc/root_user_share) is also provided to tune root
user's quota of cpu bandwidth.
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>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index e10c403b1213..f33608e9e1a2 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -200,7 +200,12 @@ struct task_grp init_task_grp = { | |||
200 | .cfs_rq = init_cfs_rq_p, | 200 | .cfs_rq = init_cfs_rq_p, |
201 | }; | 201 | }; |
202 | 202 | ||
203 | #ifdef CONFIG_FAIR_USER_SCHED | ||
204 | #define INIT_TASK_GRP_LOAD 2*NICE_0_LOAD | ||
205 | #else | ||
203 | #define INIT_TASK_GRP_LOAD NICE_0_LOAD | 206 | #define INIT_TASK_GRP_LOAD NICE_0_LOAD |
207 | #endif | ||
208 | |||
204 | static int init_task_grp_load = INIT_TASK_GRP_LOAD; | 209 | static int init_task_grp_load = INIT_TASK_GRP_LOAD; |
205 | 210 | ||
206 | /* return group to which a task belongs */ | 211 | /* return group to which a task belongs */ |
@@ -208,7 +213,11 @@ static inline struct task_grp *task_grp(struct task_struct *p) | |||
208 | { | 213 | { |
209 | struct task_grp *tg; | 214 | struct task_grp *tg; |
210 | 215 | ||
216 | #ifdef CONFIG_FAIR_USER_SCHED | ||
217 | tg = p->user->tg; | ||
218 | #else | ||
211 | tg = &init_task_grp; | 219 | tg = &init_task_grp; |
220 | #endif | ||
212 | 221 | ||
213 | return tg; | 222 | return tg; |
214 | } | 223 | } |