Commit d9a86ecc authored by David S. Miller's avatar David S. Miller

[SPARC64]: Only allocate cpu structs we really need in topology_init().

parent ee2ffc81
...@@ -678,21 +678,24 @@ void sun_do_break(void) ...@@ -678,21 +678,24 @@ void sun_do_break(void)
int serial_console; int serial_console;
int stop_a_enabled = 1; int stop_a_enabled = 1;
static struct cpu *sparc64_cpus;
static int __init topology_init(void) static int __init topology_init(void)
{ {
int i; int i, err;
sparc64_cpus = kmalloc(NR_CPUS * sizeof(struct cpu), GFP_KERNEL); err = -ENOMEM;
if (!sparc64_cpus)
return -ENOMEM;
memset(sparc64_cpus, 0, NR_CPUS * sizeof(struct cpu));
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < NR_CPUS; i++) {
if (cpu_possible(i)) if (cpu_possible(i)) {
register_cpu(&sparc64_cpus[i], i, NULL); struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
if (p) {
memset(p, 0, sizeof(*p));
register_cpu(p, i, NULL);
err = 0;
} }
return 0; }
}
return err;
} }
subsys_initcall(topology_init); subsys_initcall(topology_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment