diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-11-24 11:05:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-24 11:51:10 -0500 |
commit | 6a7b3dc3440f7b5a9b67594af01ed562cdeb41e4 (patch) | |
tree | fdbe54d2c9cd665c6a76ed09e9e4b7c51fb4df20 /kernel | |
parent | 6c99e9ad47d9c082bd096f42fb49e397b05d58a8 (diff) |
sched: convert nohz_cpu_mask to cpumask_var_t.
Impact: (future) size reduction for large NR_CPUS.
Dynamically allocating cpumasks (when CONFIG_CPUMASK_OFFSTACK) saves
space for small nr_cpu_ids but big CONFIG_NR_CPUS. 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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rcuclassic.c | 2 | ||||
-rw-r--r-- | kernel/sched.c | 7 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 10 |
3 files changed, 11 insertions, 8 deletions
diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c index e503a002f330..c03ca3e61919 100644 --- a/kernel/rcuclassic.c +++ b/kernel/rcuclassic.c | |||
@@ -393,7 +393,7 @@ static void rcu_start_batch(struct rcu_ctrlblk *rcp) | |||
393 | * unnecessarily. | 393 | * unnecessarily. |
394 | */ | 394 | */ |
395 | smp_mb(); | 395 | smp_mb(); |
396 | cpus_andnot(rcp->cpumask, cpu_online_map, nohz_cpu_mask); | 396 | cpumask_andnot(&rcp->cpumask, cpu_online_mask, nohz_cpu_mask); |
397 | 397 | ||
398 | rcp->signaled = 0; | 398 | rcp->signaled = 0; |
399 | } | 399 | } |
diff --git a/kernel/sched.c b/kernel/sched.c index 6b9606a6cabf..2723d7a4a42d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5870,9 +5870,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
5870 | * indicates which cpus entered this state. This is used | 5870 | * indicates which cpus entered this state. This is used |
5871 | * in the rcu update to wait only for active cpus. For system | 5871 | * in the rcu update to wait only for active cpus. For system |
5872 | * which do not switch off the HZ timer nohz_cpu_mask should | 5872 | * which do not switch off the HZ timer nohz_cpu_mask should |
5873 | * always be CPU_MASK_NONE. | 5873 | * always be CPU_BITS_NONE. |
5874 | */ | 5874 | */ |
5875 | cpumask_t nohz_cpu_mask = CPU_MASK_NONE; | 5875 | cpumask_var_t nohz_cpu_mask; |
5876 | 5876 | ||
5877 | /* | 5877 | /* |
5878 | * Increase the granularity value when there are more CPUs, | 5878 | * Increase the granularity value when there are more CPUs, |
@@ -8274,6 +8274,9 @@ void __init sched_init(void) | |||
8274 | */ | 8274 | */ |
8275 | current->sched_class = &fair_sched_class; | 8275 | current->sched_class = &fair_sched_class; |
8276 | 8276 | ||
8277 | /* Allocate the nohz_cpu_mask if CONFIG_CPUMASK_OFFSTACK */ | ||
8278 | alloc_bootmem_cpumask_var(&nohz_cpu_mask); | ||
8279 | |||
8277 | scheduler_running = 1; | 8280 | scheduler_running = 1; |
8278 | } | 8281 | } |
8279 | 8282 | ||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 342fc9ccab46..70f872c71f4e 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -144,7 +144,7 @@ void tick_nohz_update_jiffies(void) | |||
144 | if (!ts->tick_stopped) | 144 | if (!ts->tick_stopped) |
145 | return; | 145 | return; |
146 | 146 | ||
147 | cpu_clear(cpu, nohz_cpu_mask); | 147 | cpumask_clear_cpu(cpu, nohz_cpu_mask); |
148 | now = ktime_get(); | 148 | now = ktime_get(); |
149 | ts->idle_waketime = now; | 149 | ts->idle_waketime = now; |
150 | 150 | ||
@@ -283,7 +283,7 @@ void tick_nohz_stop_sched_tick(int inidle) | |||
283 | if ((long)delta_jiffies >= 1) { | 283 | if ((long)delta_jiffies >= 1) { |
284 | 284 | ||
285 | if (delta_jiffies > 1) | 285 | if (delta_jiffies > 1) |
286 | cpu_set(cpu, nohz_cpu_mask); | 286 | cpumask_set_cpu(cpu, nohz_cpu_mask); |
287 | /* | 287 | /* |
288 | * nohz_stop_sched_tick can be called several times before | 288 | * nohz_stop_sched_tick can be called several times before |
289 | * the nohz_restart_sched_tick is called. This happens when | 289 | * the nohz_restart_sched_tick is called. This happens when |
@@ -296,7 +296,7 @@ void tick_nohz_stop_sched_tick(int inidle) | |||
296 | /* | 296 | /* |
297 | * sched tick not stopped! | 297 | * sched tick not stopped! |
298 | */ | 298 | */ |
299 | cpu_clear(cpu, nohz_cpu_mask); | 299 | cpumask_clear_cpu(cpu, nohz_cpu_mask); |
300 | goto out; | 300 | goto out; |
301 | } | 301 | } |
302 | 302 | ||
@@ -354,7 +354,7 @@ void tick_nohz_stop_sched_tick(int inidle) | |||
354 | * softirq. | 354 | * softirq. |
355 | */ | 355 | */ |
356 | tick_do_update_jiffies64(ktime_get()); | 356 | tick_do_update_jiffies64(ktime_get()); |
357 | cpu_clear(cpu, nohz_cpu_mask); | 357 | cpumask_clear_cpu(cpu, nohz_cpu_mask); |
358 | } | 358 | } |
359 | raise_softirq_irqoff(TIMER_SOFTIRQ); | 359 | raise_softirq_irqoff(TIMER_SOFTIRQ); |
360 | out: | 360 | out: |
@@ -432,7 +432,7 @@ void tick_nohz_restart_sched_tick(void) | |||
432 | select_nohz_load_balancer(0); | 432 | select_nohz_load_balancer(0); |
433 | now = ktime_get(); | 433 | now = ktime_get(); |
434 | tick_do_update_jiffies64(now); | 434 | tick_do_update_jiffies64(now); |
435 | cpu_clear(cpu, nohz_cpu_mask); | 435 | cpumask_clear_cpu(cpu, nohz_cpu_mask); |
436 | 436 | ||
437 | /* | 437 | /* |
438 | * We stopped the tick in idle. Update process times would miss the | 438 | * We stopped the tick in idle. Update process times would miss the |