Skip to content

Commit

Permalink
cpumask: put cpumask_of_cpu_map in the initdata section
Browse files Browse the repository at this point in the history
  * Create the cpumask_of_cpu_map statically in the init data section
    using NR_CPUS but replace it during boot up with one sized by
    nr_cpu_ids (num possible cpus).

Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Mike Travis authored and Ingo Molnar committed Jul 26, 2008
1 parent b8d317d commit 6524d93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions arch/x86/kernel/setup_percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ static void __init setup_per_cpu_maps(void)
}

#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
cpumask_t *cpumask_of_cpu_map __read_mostly;
EXPORT_SYMBOL(cpumask_of_cpu_map);

/* requires nr_cpu_ids to be initialized */
/*
* Replace static cpumask_of_cpu_map in the initdata section,
* with one that's allocated sized by the possible number of cpus.
*
* (requires nr_cpu_ids to be initialized)
*/
static void __init setup_cpumask_of_cpu(void)
{
int i;
Expand Down
8 changes: 5 additions & 3 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ void __ref enable_nonboot_cpus(void)

#endif /* CONFIG_SMP */

#ifndef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
/* 64 bits of zeros, for initializers. */
#if BITS_PER_LONG == 32
#define Z64 0, 0
Expand Down Expand Up @@ -509,7 +508,11 @@ void __ref enable_nonboot_cpus(void)

/* We want this statically initialized, just to be safe. We try not
* to waste too much space, either. */
static const cpumask_t cpumask_map[] = {
static const cpumask_t cpumask_map[]
#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
__initdata
#endif
= {
CMI0(0), CMI0(1), CMI0(2), CMI0(3),
#if NR_CPUS > 4
CMI0(4), CMI0(5), CMI0(6), CMI0(7),
Expand Down Expand Up @@ -569,4 +572,3 @@ static const cpumask_t cpumask_map[] = {
};

const cpumask_t *cpumask_of_cpu_map = cpumask_map;
#endif /* !CONFIG_HAVE_CPUMASK_OF_CPU_MAP */

0 comments on commit 6524d93

Please sign in to comment.