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>
This commit is contained in:
committed by
Ingo Molnar
parent
9b5b77512d
commit
24e377a832
@@ -200,7 +200,12 @@ struct task_grp init_task_grp = {
|
||||
.cfs_rq = init_cfs_rq_p,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FAIR_USER_SCHED
|
||||
#define INIT_TASK_GRP_LOAD 2*NICE_0_LOAD
|
||||
#else
|
||||
#define INIT_TASK_GRP_LOAD NICE_0_LOAD
|
||||
#endif
|
||||
|
||||
static int init_task_grp_load = INIT_TASK_GRP_LOAD;
|
||||
|
||||
/* return group to which a task belongs */
|
||||
@@ -208,7 +213,11 @@ static inline struct task_grp *task_grp(struct task_struct *p)
|
||||
{
|
||||
struct task_grp *tg;
|
||||
|
||||
#ifdef CONFIG_FAIR_USER_SCHED
|
||||
tg = p->user->tg;
|
||||
#else
|
||||
tg = &init_task_grp;
|
||||
#endif
|
||||
|
||||
return tg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user