Skip to contentSkip to conversation

sched: Ditch per cgroup task lists for load-balancing

tip:sched/core tip-bot for Peter Zijlstra 1 participant 1 message Mar 1, 2012 Scheduler

lore
Share & tools
lore
#0 lore raw
Commit-ID:  a15a53d4b8ef2fefb64cddb63924aa424464dde1
Gitweb:     http://git.kernel.org/tip/a15a53d4b8ef2fefb64cddb63924aa424464dde1
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Mon, 20 Feb 2012 21:49:09 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 1 Mar 2012 10:51:24 +0100

sched: Ditch per cgroup task lists for load-balancing

Per cgroup load-balance has numerous problems, chief amongst them that there is no real sane order in them. So stop pretending it makes sense and enqueue all tasks on a single list.

This also allows us to more easily fix the fwd progress issue uncovered by the lock-break stuff. Rotate the list on failure to migreate and limit the total iterations to nr_running (which with releasing the lock isn't strictly accurate but close enough).

Also add a filter that skips very light tasks on the first attempt around the list, this attempts to avoid shooting whole cgroups around without affecting over balance.

---
 kernel/sched/core.c  |    3 +
 kernel/sched/fair.c  |  174 +++++++++++++++++++++-----------------------------
 kernel/sched/sched.h |   10 +--
 3 files changed, 78 insertions(+), 109 deletions(-)
kernel/sched/core.c +3 -0
index 25e06a5..9554512 100644
@@ -6959,6 +6959,9 @@ void __init sched_init(void)
 		rq->online = 0;
 		rq->idle_stamp = 0;
 		rq->avg_idle = 2*sysctl_sched_migration_cost;
+
+		INIT_LIST_HEAD(&rq->cfs_tasks);
+
 		rq_attach_root(rq, &def_root_domain);
 #ifdef CONFIG_NO_HZ
 		rq->nohz_flags = 0;
kernel/sched/fair.c +73 -101

296 lines not on this page · raw message

kernel/sched/sched.h +2 -8
index c0660a1..753bdd5 100644
@@ -212,9 +212,6 @@ struct cfs_rq {
 	struct rb_root tasks_timeline;
 	struct rb_node *rb_leftmost;
 
-	struct list_head tasks;
-	struct list_head *balance_iterator;
-
 	/*
 	 * 'curr' points to currently running entity on this cfs_rq.
 	 * It is set to NULL otherwise (i.e when none are currently running).
@@ -242,11 +239,6 @@ struct cfs_rq {
 
 #ifdef CONFIG_SMP
 	/*
-	 * the part of load.weight contributed by tasks
-	 */
-	unsigned long task_weight;
-
-	/*
 	 *   h_load = weight * f(tg)
 	 *
 	 * Where f(tg) is the recursive weight fraction assigned to
@@ -420,6 +412,8 @@ struct rq {
 	int cpu;
 	int online;
 
+	struct list_head cfs_tasks;
+
 	u64 rt_avg;
 	u64 age_stamp;
 	u64 idle_stamp;