From 8f162daea414aa9d534b4b70908699b6d65e78fb Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Thu, 3 Dec 2009 18:00:07 +0100 Subject: [PATCH] --- yaml --- r: 175588 b: refs/heads/master c: cd8ad40de36c2fe75f3b731bd70198b385895246 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/sched.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 98d738739ab9..82e881695393 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fb58bac5c75bfff8bbf7d02071a10a62f32fe28b +refs/heads/master: cd8ad40de36c2fe75f3b731bd70198b385895246 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 0170735bdafc..71eb0622f548 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -1614,7 +1614,7 @@ static void update_group_shares_cpu(struct task_group *tg, int cpu, */ static int tg_shares_up(struct task_group *tg, void *data) { - unsigned long weight, rq_weight = 0, shares = 0; + unsigned long weight, rq_weight = 0, sum_weight = 0, shares = 0; unsigned long *usd_rq_weight; struct sched_domain *sd = data; unsigned long flags; @@ -1630,6 +1630,7 @@ static int tg_shares_up(struct task_group *tg, void *data) weight = tg->cfs_rq[i]->load.weight; usd_rq_weight[i] = weight; + rq_weight += weight; /* * If there are currently no tasks on the cpu pretend there * is one of average load so that when a new task gets to @@ -1638,10 +1639,13 @@ static int tg_shares_up(struct task_group *tg, void *data) if (!weight) weight = NICE_0_LOAD; - rq_weight += weight; + sum_weight += weight; shares += tg->cfs_rq[i]->shares; } + if (!rq_weight) + rq_weight = sum_weight; + if ((!shares && rq_weight) || shares > tg->shares) shares = tg->shares;