diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-11 02:03:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-18 08:51:51 -0400 |
commit | c38da5692e3a4d5d303c04cbf7e526f1eb761076 (patch) | |
tree | af07c37fd1961382ff359912ca49c6afacdbdf91 | |
parent | 89bd55d1855f8e9a4e9add8e93f3144d049c469e (diff) |
x86: cpumask: x86 mmio-mod.c use cpumask_var_t for downed_cpus
Impact: cleanup, reduce memory usage for CONFIG_CPUMASK_OFFSTACK=y
Part of the "getting rid of obsolete cpumask_t" patch:
1) Use cpumask_var_t: this is a pointer if CONFIG_CPUMASK_OFFSTACK=y
2) Call alloc_cpumask_var() on first entry into enter_uniprocessor()
3) Use modern cpumask_* functions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Pekka Paalanen <pq@iki.fi>
LKML-Reference: <200903111633.55952.rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/mm/mmio-mod.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c index 2c4baa88f2cb..c9342ed8b402 100644 --- a/arch/x86/mm/mmio-mod.c +++ b/arch/x86/mm/mmio-mod.c | |||
@@ -378,27 +378,34 @@ static void clear_trace_list(void) | |||
378 | } | 378 | } |
379 | 379 | ||
380 | #ifdef CONFIG_HOTPLUG_CPU | 380 | #ifdef CONFIG_HOTPLUG_CPU |
381 | static cpumask_t downed_cpus; | 381 | static cpumask_var_t downed_cpus; |
382 | 382 | ||
383 | static void enter_uniprocessor(void) | 383 | static void enter_uniprocessor(void) |
384 | { | 384 | { |
385 | int cpu; | 385 | int cpu; |
386 | int err; | 386 | int err; |
387 | 387 | ||
388 | if (downed_cpus == NULL && | ||
389 | !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) { | ||
390 | pr_notice(NAME "Failed to allocate mask\n"); | ||
391 | goto out; | ||
392 | } | ||
393 | |||
388 | get_online_cpus(); | 394 | get_online_cpus(); |
389 | downed_cpus = cpu_online_map; | 395 | cpumask_copy(downed_cpus, cpu_online_mask); |
390 | cpu_clear(first_cpu(cpu_online_map), downed_cpus); | 396 | cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus); |
391 | if (num_online_cpus() > 1) | 397 | if (num_online_cpus() > 1) |
392 | pr_notice(NAME "Disabling non-boot CPUs...\n"); | 398 | pr_notice(NAME "Disabling non-boot CPUs...\n"); |
393 | put_online_cpus(); | 399 | put_online_cpus(); |
394 | 400 | ||
395 | for_each_cpu_mask(cpu, downed_cpus) { | 401 | for_each_cpu(cpu, downed_cpus) { |
396 | err = cpu_down(cpu); | 402 | err = cpu_down(cpu); |
397 | if (!err) | 403 | if (!err) |
398 | pr_info(NAME "CPU%d is down.\n", cpu); | 404 | pr_info(NAME "CPU%d is down.\n", cpu); |
399 | else | 405 | else |
400 | pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err); | 406 | pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err); |
401 | } | 407 | } |
408 | out: | ||
402 | if (num_online_cpus() > 1) | 409 | if (num_online_cpus() > 1) |
403 | pr_warning(NAME "multiple CPUs still online, " | 410 | pr_warning(NAME "multiple CPUs still online, " |
404 | "may miss events.\n"); | 411 | "may miss events.\n"); |
@@ -411,10 +418,10 @@ static void __ref leave_uniprocessor(void) | |||
411 | int cpu; | 418 | int cpu; |
412 | int err; | 419 | int err; |
413 | 420 | ||
414 | if (cpus_weight(downed_cpus) == 0) | 421 | if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0) |
415 | return; | 422 | return; |
416 | pr_notice(NAME "Re-enabling CPUs...\n"); | 423 | pr_notice(NAME "Re-enabling CPUs...\n"); |
417 | for_each_cpu_mask(cpu, downed_cpus) { | 424 | for_each_cpu(cpu, downed_cpus) { |
418 | err = cpu_up(cpu); | 425 | err = cpu_up(cpu); |
419 | if (!err) | 426 | if (!err) |
420 | pr_info(NAME "enabled CPU%d.\n", cpu); | 427 | pr_info(NAME "enabled CPU%d.\n", cpu); |