Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158332
b: refs/heads/master
c: a500427
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 2, 2009
1 parent 47907a6 commit cfb29bf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e9ed8b02490fea577b1eb1704c05bf43c891ed7
refs/heads/master: a5004278f0525dcb9aa43703ef77bf371ea837cd
28 changes: 20 additions & 8 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1523,13 +1523,18 @@ static void
update_group_shares_cpu(struct task_group *tg, int cpu,
unsigned long sd_shares, unsigned long sd_rq_weight)
{
unsigned long shares;
unsigned long rq_weight;
unsigned long shares;
int boost = 0;

if (!tg->se[cpu])
return;

rq_weight = tg->cfs_rq[cpu]->rq_weight;
if (!rq_weight) {
boost = 1;
rq_weight = NICE_0_LOAD;
}

/*
* \Sum shares * rq_weight
Expand All @@ -1546,8 +1551,7 @@ update_group_shares_cpu(struct task_group *tg, int cpu,
unsigned long flags;

spin_lock_irqsave(&rq->lock, flags);
tg->cfs_rq[cpu]->shares = shares;

tg->cfs_rq[cpu]->shares = boost ? 0 : shares;
__set_se_shares(tg->se[cpu], shares);
spin_unlock_irqrestore(&rq->lock, flags);
}
Expand All @@ -1560,7 +1564,7 @@ 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;
unsigned long weight, rq_weight = 0, eff_weight = 0;
unsigned long shares = 0;
struct sched_domain *sd = data;
int i;
Expand All @@ -1572,11 +1576,13 @@ static int tg_shares_up(struct task_group *tg, void *data)
* run here it will not get delayed by group starvation.
*/
weight = tg->cfs_rq[i]->load.weight;
tg->cfs_rq[i]->rq_weight = weight;
rq_weight += weight;

if (!weight)
weight = NICE_0_LOAD;

tg->cfs_rq[i]->rq_weight = weight;
rq_weight += weight;
eff_weight += weight;
shares += tg->cfs_rq[i]->shares;
}

Expand All @@ -1586,8 +1592,14 @@ static int tg_shares_up(struct task_group *tg, void *data)
if (!sd->parent || !(sd->parent->flags & SD_LOAD_BALANCE))
shares = tg->shares;

for_each_cpu(i, sched_domain_span(sd))
update_group_shares_cpu(tg, i, shares, rq_weight);
for_each_cpu(i, sched_domain_span(sd)) {
unsigned long sd_rq_weight = rq_weight;

if (!tg->cfs_rq[i]->rq_weight)
sd_rq_weight = eff_weight;

update_group_shares_cpu(tg, i, shares, sd_rq_weight);
}

return 0;
}
Expand Down

0 comments on commit cfb29bf

Please sign in to comment.