diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-11-15 18:47:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-18 07:27:47 -0500 |
commit | 9e3081ca61147b29f52fddb4f7c6b6b82ea5eb7a (patch) | |
tree | 74ec7a4f3e544ed64afb6cb7abe6322ca700d19a /kernel/sched.c | |
parent | 3d4b47b4b040c9d77dd68104cfc1055d89a55afd (diff) |
sched: Make tg_shares_up() walk on-demand
Make tg_shares_up() use the active cgroup list, this means we cannot
do a strict bottom-up walk of the hierarchy, but assuming its a very
wide tree with a small number of active groups it should be a win.
Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20101115234937.754159484@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 22436dd2e19f..6268d2dc9a91 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -279,13 +279,6 @@ static DEFINE_SPINLOCK(task_group_lock); | |||
279 | 279 | ||
280 | #ifdef CONFIG_FAIR_GROUP_SCHED | 280 | #ifdef CONFIG_FAIR_GROUP_SCHED |
281 | 281 | ||
282 | #ifdef CONFIG_SMP | ||
283 | static int root_task_group_empty(void) | ||
284 | { | ||
285 | return list_empty(&root_task_group.children); | ||
286 | } | ||
287 | #endif | ||
288 | |||
289 | # define INIT_TASK_GROUP_LOAD NICE_0_LOAD | 282 | # define INIT_TASK_GROUP_LOAD NICE_0_LOAD |
290 | 283 | ||
291 | /* | 284 | /* |
@@ -1546,48 +1539,6 @@ static unsigned long cpu_avg_load_per_task(int cpu) | |||
1546 | 1539 | ||
1547 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1540 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1548 | 1541 | ||
1549 | static void update_cfs_load(struct cfs_rq *cfs_rq, int lb); | ||
1550 | static void update_cfs_shares(struct cfs_rq *cfs_rq); | ||
1551 | |||
1552 | /* | ||
1553 | * update tg->load_weight by folding this cpu's load_avg | ||
1554 | */ | ||
1555 | static int tg_shares_up(struct task_group *tg, void *data) | ||
1556 | { | ||
1557 | long load_avg; | ||
1558 | struct cfs_rq *cfs_rq; | ||
1559 | unsigned long flags; | ||
1560 | int cpu = (long)data; | ||
1561 | struct rq *rq; | ||
1562 | |||
1563 | if (!tg->se[cpu]) | ||
1564 | return 0; | ||
1565 | |||
1566 | rq = cpu_rq(cpu); | ||
1567 | cfs_rq = tg->cfs_rq[cpu]; | ||
1568 | |||
1569 | raw_spin_lock_irqsave(&rq->lock, flags); | ||
1570 | |||
1571 | update_rq_clock(rq); | ||
1572 | update_cfs_load(cfs_rq, 1); | ||
1573 | |||
1574 | load_avg = div64_u64(cfs_rq->load_avg, cfs_rq->load_period+1); | ||
1575 | load_avg -= cfs_rq->load_contribution; | ||
1576 | |||
1577 | atomic_add(load_avg, &tg->load_weight); | ||
1578 | cfs_rq->load_contribution += load_avg; | ||
1579 | |||
1580 | /* | ||
1581 | * We need to update shares after updating tg->load_weight in | ||
1582 | * order to adjust the weight of groups with long running tasks. | ||
1583 | */ | ||
1584 | update_cfs_shares(cfs_rq); | ||
1585 | |||
1586 | raw_spin_unlock_irqrestore(&rq->lock, flags); | ||
1587 | |||
1588 | return 0; | ||
1589 | } | ||
1590 | |||
1591 | /* | 1542 | /* |
1592 | * Compute the cpu's hierarchical load factor for each task group. | 1543 | * Compute the cpu's hierarchical load factor for each task group. |
1593 | * This needs to be done in a top-down fashion because the load of a child | 1544 | * This needs to be done in a top-down fashion because the load of a child |
@@ -1611,29 +1562,11 @@ static int tg_load_down(struct task_group *tg, void *data) | |||
1611 | return 0; | 1562 | return 0; |
1612 | } | 1563 | } |
1613 | 1564 | ||
1614 | static void update_shares(long cpu) | ||
1615 | { | ||
1616 | if (root_task_group_empty()) | ||
1617 | return; | ||
1618 | |||
1619 | /* | ||
1620 | * XXX: replace with an on-demand list | ||
1621 | */ | ||
1622 | |||
1623 | walk_tg_tree(tg_nop, tg_shares_up, (void *)cpu); | ||
1624 | } | ||
1625 | |||
1626 | static void update_h_load(long cpu) | 1565 | static void update_h_load(long cpu) |
1627 | { | 1566 | { |
1628 | walk_tg_tree(tg_load_down, tg_nop, (void *)cpu); | 1567 | walk_tg_tree(tg_load_down, tg_nop, (void *)cpu); |
1629 | } | 1568 | } |
1630 | 1569 | ||
1631 | #else | ||
1632 | |||
1633 | static inline void update_shares(int cpu) | ||
1634 | { | ||
1635 | } | ||
1636 | |||
1637 | #endif | 1570 | #endif |
1638 | 1571 | ||
1639 | #ifdef CONFIG_PREEMPT | 1572 | #ifdef CONFIG_PREEMPT |