diff options
author | Jiri Kosina <jkosina@suse.cz> | 2009-10-28 11:26:00 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-10-28 11:26:00 -0400 |
commit | 4a6cc4bd32e580722882115d4c8b964d732c11e4 (patch) | |
tree | dbfa457caf9a65231f2f55c1ad03cf4d6f16f67c /kernel/sched.c | |
parent | 403a91b1659cb149dbddc5885f892734ae4542d8 (diff) |
sched: move rq_weight data array out of .percpu
Commit 34d76c41 introduced percpu array update_shares_data, size of which
being proportional to NR_CPUS. Unfortunately this blows up ia64 for large
NR_CPUS configuration, as ia64 allows only 64k for .percpu section.
Fix this by allocating this array dynamically and keep only pointer to it
percpu.
The per-cpu handling doesn't impose significant performance penalty on
potentially contented path in tg_shares_up().
...
ffffffff8104337c: 65 48 8b 14 25 20 cd mov %gs:0xcd20,%rdx
ffffffff81043383: 00 00
ffffffff81043385: 48 c7 c0 00 e1 00 00 mov $0xe100,%rax
ffffffff8104338c: 48 c7 45 a0 00 00 00 movq $0x0,-0x60(%rbp)
ffffffff81043393: 00
ffffffff81043394: 48 c7 45 a8 00 00 00 movq $0x0,-0x58(%rbp)
ffffffff8104339b: 00
ffffffff8104339c: 48 01 d0 add %rdx,%rax
ffffffff8104339f: 49 8d 94 24 08 01 00 lea 0x108(%r12),%rdx
ffffffff810433a6: 00
ffffffff810433a7: b9 ff ff ff ff mov $0xffffffff,%ecx
ffffffff810433ac: 48 89 45 b0 mov %rax,-0x50(%rbp)
ffffffff810433b0: bb 00 04 00 00 mov $0x400,%ebx
ffffffff810433b5: 48 89 55 c0 mov %rdx,-0x40(%rbp)
...
After:
...
ffffffff8104337c: 65 8b 04 25 28 cd 00 mov %gs:0xcd28,%eax
ffffffff81043383: 00
ffffffff81043384: 48 98 cltq
ffffffff81043386: 49 8d bc 24 08 01 00 lea 0x108(%r12),%rdi
ffffffff8104338d: 00
ffffffff8104338e: 48 8b 15 d3 7f 76 00 mov 0x767fd3(%rip),%rdx # ffffffff817ab368 <update_shares_data>
ffffffff81043395: 48 8b 34 c5 00 ee 6d mov -0x7e921200(,%rax,8),%rsi
ffffffff8104339c: 81
ffffffff8104339d: 48 c7 45 a0 00 00 00 movq $0x0,-0x60(%rbp)
ffffffff810433a4: 00
ffffffff810433a5: b9 ff ff ff ff mov $0xffffffff,%ecx
ffffffff810433aa: 48 89 7d c0 mov %rdi,-0x40(%rbp)
ffffffff810433ae: 48 c7 45 a8 00 00 00 movq $0x0,-0x58(%rbp)
ffffffff810433b5: 00
ffffffff810433b6: bb 00 04 00 00 mov $0x400,%ebx
ffffffff810433bb: 48 01 f2 add %rsi,%rdx
ffffffff810433be: 48 89 55 b0 mov %rdx,-0x50(%rbp)
...
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index ee61f454a98b..526d237b8ce5 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -1563,11 +1563,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) | |||
1563 | 1563 | ||
1564 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1564 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1565 | 1565 | ||
1566 | struct update_shares_data { | 1566 | static __read_mostly unsigned long *update_shares_data; |
1567 | unsigned long rq_weight[NR_CPUS]; | ||
1568 | }; | ||
1569 | |||
1570 | static DEFINE_PER_CPU(struct update_shares_data, update_shares_data); | ||
1571 | 1567 | ||
1572 | static void __set_se_shares(struct sched_entity *se, unsigned long shares); | 1568 | static void __set_se_shares(struct sched_entity *se, unsigned long shares); |
1573 | 1569 | ||
@@ -1577,12 +1573,12 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares); | |||
1577 | static void update_group_shares_cpu(struct task_group *tg, int cpu, | 1573 | static void update_group_shares_cpu(struct task_group *tg, int cpu, |
1578 | unsigned long sd_shares, | 1574 | unsigned long sd_shares, |
1579 | unsigned long sd_rq_weight, | 1575 | unsigned long sd_rq_weight, |
1580 | struct update_shares_data *usd) | 1576 | unsigned long *usd_rq_weight) |
1581 | { | 1577 | { |
1582 | unsigned long shares, rq_weight; | 1578 | unsigned long shares, rq_weight; |
1583 | int boost = 0; | 1579 | int boost = 0; |
1584 | 1580 | ||
1585 | rq_weight = usd->rq_weight[cpu]; | 1581 | rq_weight = usd_rq_weight[cpu]; |
1586 | if (!rq_weight) { | 1582 | if (!rq_weight) { |
1587 | boost = 1; | 1583 | boost = 1; |
1588 | rq_weight = NICE_0_LOAD; | 1584 | rq_weight = NICE_0_LOAD; |
@@ -1617,7 +1613,7 @@ static void update_group_shares_cpu(struct task_group *tg, int cpu, | |||
1617 | static int tg_shares_up(struct task_group *tg, void *data) | 1613 | static int tg_shares_up(struct task_group *tg, void *data) |
1618 | { | 1614 | { |
1619 | unsigned long weight, rq_weight = 0, shares = 0; | 1615 | unsigned long weight, rq_weight = 0, shares = 0; |
1620 | struct update_shares_data *usd; | 1616 | unsigned long *usd_rq_weight; |
1621 | struct sched_domain *sd = data; | 1617 | struct sched_domain *sd = data; |
1622 | unsigned long flags; | 1618 | unsigned long flags; |
1623 | int i; | 1619 | int i; |
@@ -1626,11 +1622,11 @@ static int tg_shares_up(struct task_group *tg, void *data) | |||
1626 | return 0; | 1622 | return 0; |
1627 | 1623 | ||
1628 | local_irq_save(flags); | 1624 | local_irq_save(flags); |
1629 | usd = &__get_cpu_var(update_shares_data); | 1625 | usd_rq_weight = per_cpu_ptr(update_shares_data, smp_processor_id()); |
1630 | 1626 | ||
1631 | for_each_cpu(i, sched_domain_span(sd)) { | 1627 | for_each_cpu(i, sched_domain_span(sd)) { |
1632 | weight = tg->cfs_rq[i]->load.weight; | 1628 | weight = tg->cfs_rq[i]->load.weight; |
1633 | usd->rq_weight[i] = weight; | 1629 | usd_rq_weight[i] = weight; |
1634 | 1630 | ||
1635 | /* | 1631 | /* |
1636 | * If there are currently no tasks on the cpu pretend there | 1632 | * If there are currently no tasks on the cpu pretend there |
@@ -1651,7 +1647,7 @@ static int tg_shares_up(struct task_group *tg, void *data) | |||
1651 | shares = tg->shares; | 1647 | shares = tg->shares; |
1652 | 1648 | ||
1653 | for_each_cpu(i, sched_domain_span(sd)) | 1649 | for_each_cpu(i, sched_domain_span(sd)) |
1654 | update_group_shares_cpu(tg, i, shares, rq_weight, usd); | 1650 | update_group_shares_cpu(tg, i, shares, rq_weight, usd_rq_weight); |
1655 | 1651 | ||
1656 | local_irq_restore(flags); | 1652 | local_irq_restore(flags); |
1657 | 1653 | ||
@@ -9406,6 +9402,10 @@ void __init sched_init(void) | |||
9406 | #endif /* CONFIG_USER_SCHED */ | 9402 | #endif /* CONFIG_USER_SCHED */ |
9407 | #endif /* CONFIG_GROUP_SCHED */ | 9403 | #endif /* CONFIG_GROUP_SCHED */ |
9408 | 9404 | ||
9405 | #if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP | ||
9406 | update_shares_data = __alloc_percpu(nr_cpu_ids * sizeof(unsigned long), | ||
9407 | __alignof__(unsigned long)); | ||
9408 | #endif | ||
9409 | for_each_possible_cpu(i) { | 9409 | for_each_possible_cpu(i) { |
9410 | struct rq *rq; | 9410 | struct rq *rq; |
9411 | 9411 | ||