diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-11-24 11:05:10 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-24 11:51:30 -0500 |
commit | 4d2732c63e0c05cfef2a74868d08eace922dfc3e (patch) | |
tree | 775cd2e595d09ef1f5ae9c3ea66cf69374eed647 | |
parent | 7d1e6a9b95e3edeac91888bc683ae62f18519432 (diff) |
sched: convert idle_balance() to cpumask_var_t.
Impact: stack usage reduction
Dynamically allocating cpumasks (when CONFIG_CPUMASK_OFFSTACK) saves
space in the stack. cpumask_var_t is just a struct cpumask for
!CONFIG_CPUMASK_OFFSTACK.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 2f8ea99df16a..154a95fcea7e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3676,7 +3676,10 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3676 | struct sched_domain *sd; | 3676 | struct sched_domain *sd; |
3677 | int pulled_task = -1; | 3677 | int pulled_task = -1; |
3678 | unsigned long next_balance = jiffies + HZ; | 3678 | unsigned long next_balance = jiffies + HZ; |
3679 | cpumask_t tmpmask; | 3679 | cpumask_var_t tmpmask; |
3680 | |||
3681 | if (!alloc_cpumask_var(&tmpmask, GFP_ATOMIC)) | ||
3682 | return; | ||
3680 | 3683 | ||
3681 | for_each_domain(this_cpu, sd) { | 3684 | for_each_domain(this_cpu, sd) { |
3682 | unsigned long interval; | 3685 | unsigned long interval; |
@@ -3687,7 +3690,7 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3687 | if (sd->flags & SD_BALANCE_NEWIDLE) | 3690 | if (sd->flags & SD_BALANCE_NEWIDLE) |
3688 | /* If we've pulled tasks over stop searching: */ | 3691 | /* If we've pulled tasks over stop searching: */ |
3689 | pulled_task = load_balance_newidle(this_cpu, this_rq, | 3692 | pulled_task = load_balance_newidle(this_cpu, this_rq, |
3690 | sd, &tmpmask); | 3693 | sd, tmpmask); |
3691 | 3694 | ||
3692 | interval = msecs_to_jiffies(sd->balance_interval); | 3695 | interval = msecs_to_jiffies(sd->balance_interval); |
3693 | if (time_after(next_balance, sd->last_balance + interval)) | 3696 | if (time_after(next_balance, sd->last_balance + interval)) |
@@ -3702,6 +3705,7 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3702 | */ | 3705 | */ |
3703 | this_rq->next_balance = next_balance; | 3706 | this_rq->next_balance = next_balance; |
3704 | } | 3707 | } |
3708 | free_cpumask_var(tmpmask); | ||
3705 | } | 3709 | } |
3706 | 3710 | ||
3707 | /* | 3711 | /* |