Commit cd8ad40de36c2fe75f3b731bd70198b385895246
Committed by
Ingo Molnar
1 parent
fb58bac5c7
Exists in
master
and in
7 other branches
sched: cgroup: Implement different treatment for idle shares
When setting the weight for a per-cpu task-group, we have to put in a phantom weight when there is no work on that cpu, otherwise we'll not service that cpu when new work gets placed there until we again update the per-cpu weights. We used to add these phantom weights to the total, so that the idle per-cpu shares don't get inflated, this however causes the non-idle parts to get deflated, causing unexpected weight distibutions. Reverse this, so that the non-idle shares are correct but the idle shares are inflated. Reported-by: Yasunori Goto <y-goto@jp.fujitsu.com> Tested-by: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1257934048.23203.76.camel@twins> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff
kernel/sched.c
... | ... | @@ -1614,7 +1614,7 @@ |
1614 | 1614 | */ |
1615 | 1615 | static int tg_shares_up(struct task_group *tg, void *data) |
1616 | 1616 | { |
1617 | - unsigned long weight, rq_weight = 0, shares = 0; | |
1617 | + unsigned long weight, rq_weight = 0, sum_weight = 0, shares = 0; | |
1618 | 1618 | unsigned long *usd_rq_weight; |
1619 | 1619 | struct sched_domain *sd = data; |
1620 | 1620 | unsigned long flags; |
... | ... | @@ -1630,6 +1630,7 @@ |
1630 | 1630 | weight = tg->cfs_rq[i]->load.weight; |
1631 | 1631 | usd_rq_weight[i] = weight; |
1632 | 1632 | |
1633 | + rq_weight += weight; | |
1633 | 1634 | /* |
1634 | 1635 | * If there are currently no tasks on the cpu pretend there |
1635 | 1636 | * is one of average load so that when a new task gets to |
1636 | 1637 | |
... | ... | @@ -1638,9 +1639,12 @@ |
1638 | 1639 | if (!weight) |
1639 | 1640 | weight = NICE_0_LOAD; |
1640 | 1641 | |
1641 | - rq_weight += weight; | |
1642 | + sum_weight += weight; | |
1642 | 1643 | shares += tg->cfs_rq[i]->shares; |
1643 | 1644 | } |
1645 | + | |
1646 | + if (!rq_weight) | |
1647 | + rq_weight = sum_weight; | |
1644 | 1648 | |
1645 | 1649 | if ((!shares && rq_weight) || shares > tg->shares) |
1646 | 1650 | shares = tg->shares; |