OpenVZ Forum - RDF feed
type: channel
items: [PATCH 0/2] Add group awareness to CFS - v2
items: [PATCH 1/2] Introduce notion of scheduler hierarchy
items: [PATCH 2/2] Hook up to (process) container feature in mm tree
items: Re: [PATCH 0/2] Add group awareness to CFS - v2

[PATCH 0/2] Add group awareness to CFS - v2
type: item
description: Hi Ingo, Here's an update for the group-aware CFS scheduler that I have been working on. (For those reading these patches for the first time:) The basic idea is to reuse CFS core and other pieces of scheduler like smpnice-driven load balance for driving fairness between 'schedulable entities' other than tasks, for ex: users or containers. The time-sorted rb-tree and nanosecond accurate accounting aspects of CFS are "repeated" for schedulable entities other than tasks. For ex: there could be N task-level rb-trees for N users (which stores tasks) and a single user-level rb-tree which stores user-level entities. CFS operations on each user's task-level rb-tree drives fairness between tasks of that user, while CFS operations on user-level rb-tree drives fairness between users. v17 CFS introduced basic changes in CFS to support group scheduling. The two patches to follow build upon them as follows: Patch 1 => introduces a notion of scheduler hierarchy (of entities) and applies CFS operations at all levels of this hierarchy. Patch 2 => hooks up the cpu scheduler with task grouping feature in mm tree (CONFIG_CONTAINERS) as an interface to task-grouping functionality. A single config option CONFIG_FAIR_GROUP_SCHED allows the group-scheduling feature to be turned on/off at compile time. I have tried my best to ensure there is no impact to existing CFS performance when CONFIG_FAIR_GROUP_SCHED is disabled. Some results in this regard are provided at the end. One noticeable change in functionality may be the /proc/sched_debug output (I had to rearrange that code a bit to dump group cfs_rq information also). Changes since last version: - Fixed some bugs in SMP load balance (pointed by Dmitry) - Modified sched_debug.c to dump all cfs_rq stats Todo: - Weighted fair-share Currently all groups get "equal" cpu bandwidth. I plan to support weighted fair-sharing on the lines of task niceness. - Separate out tunable Right now tunable are same for all layers of scheduling. I strongly thi…
creator: Srivatsa Vaddagiri
date: 2007-06-23T13:15:45-00:00

[PATCH 1/2] Introduce notion of scheduler hierarchy
type: item
description: This patch introduces the core changes in CFS required to accomplish group fairness at higher levels. It also modifies load balance interface between classes a bit, so that move_tasks (which is centric to load balance) can be reused to balance between runqueues of various types (struct rq in case of SCHED_RT tasks, struct lrq in case of SCHED_NORMAL/BATCH tasks). Signed-off-by : Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> --- include/linux/sched.h | 17 ++ kernel/sched.c | 174 ++++++++++++++++------------ kernel/sched_debug.c | 31 +++-- kernel/sched_fair.c | 295 ++++++++++++++++++++++++++++++++++++++++++++---- kernel/sched_idletask.c | 11 + kernel/sched_rt.c | 47 ++++++- 6 files changed, 464 insertions(+), 111 deletions(-) Index: current/include/linux/sched.h =================================================================== --- current.orig/include/linux/sched.h +++ current/include/linux/sched.h @@ -134,8 +134,11 @@ extern unsigned long nr_iowait(void); extern unsigned long weighted_cpuload(const int cpu); struct seq_file; +struct cfs_rq; extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); extern void proc_sched_set_task(struct task_struct *p); +extern void +print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now); /* * Task state bitmask. NOTE! These bits are also @@ -865,8 +868,13 @@ struct sched_class { struct task_struct * (*pick_next_task) (struct rq *rq, u64 now); void (*put_prev_task) (struct rq *rq, struct task_struct *p, u64 now); - struct task_struct * (*load_balance_start) (struct rq *rq); - struct task_struct * (*load_balance_next) (struct rq *rq); + int (*load_balance) (struct rq *this_rq, int this_cpu, + struct rq *busiest, + unsigned long max_nr_move, unsigned long max_load_move, + struct sched_domain *sd, enum cpu_idle_type idle, + int *all_pinned, unsigned long *total_load_moved); + + void (*set_curr_task) (struct rq *rq); void (*task_tick) (struct rq *rq, struct task_struct *p); void (*task_new) (struct …
creator: Srivatsa Vaddagiri
date: 2007-06-23T13:18:07-00:00

[PATCH 2/2] Hook up to (process) container feature in mm tree
type: item
description: This patch hooks up cpu scheduler with Paul Menage's container infrastructure. The container patches allows administrator to create arbitrary groups of tasks and define resource allocation for each group. By registering with container infrastructure, cpu scheduler is made aware of group membership information for each task, creation/deletion of groups etc and can use that information to provide fairness between groups. This mechanism can indirectly be used to provide fairness between users also. All that is needed is a user-space program (which is being working upon) which monitors for PROC_EVENT_UID events (using process event connector) and moves the task to appropriate user-directory in container filesystem. As an example for "HOWTO use this feature", follow these steps: 1. Define CONFIG_FAIR_GROUP_SCHED (General Setup->Fair Group Scheduler) and compile the kernel 2. After booting: # cd /dev # mkdir cpuctl # mount -t container -ocpuctl none /dev/cpuctl # cd cpuctl # mkdir grpA # mkdir grpB # echo some_pid1 > grpA/tasks # echo some_pid2 > grpA/tasks # echo some_pid3 > grpA/tasks # echo some_pid4 > grpA/tasks ... # echo another_pidX > grpB/tasks # echo another_pidY > grpB/tasks All tasks in grpA/tasks should cumulatively share same CPU as all tasks in grpB/tasks. Signed-off-by : Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> --- include/linux/container_subsys.h | 6 init/Kconfig | 10 + kernel/sched.c | 250 +++++++++++++++++++++++++++++++++++++-- kernel/sched_fair.c | 3 4 files changed, 256 insertions(+), 13 deletions(-) Index: current/include/linux/container_subsys.h =================================================================== --- current.orig/include/linux/container_subsys.h +++ current/include/linux/container_subsys.h @@ -24,3 +24,9 @@ SUBSYS(debug) #endif /* */ + +#ifdef CONFIG_FAIR_GROUP_SCHED +SUBSYS(cpuctlr) +#endif + +/* */ Index: current/init/Kconfig =================================================================== --- current.orig/init/Kconfig +++ c…
creator: Srivatsa Vaddagiri
date: 2007-06-23T13:20:04-00:00

Re: [PATCH 0/2] Add group awareness to CFS - v2
type: item
description: * Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> wrote: > Hi Ingo, > Here's an update for the group-aware CFS scheduler that I have > been working on. thanks. I've carried your patch #1 (core changes) for the past few days and it's looking pretty good so far! This makes the container-scheduling patch (patch #2) a pretty painless add-on. Ingo _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Ingo Molnar
date: 2007-06-26T08:52:33-00:00