Commit 96619fc1 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/smp: reduce memory consumption of pcpu_devices array

Remove the embedded struct cpu from struct pcpu and replace it with a
pointer instead. The struct cpu now gets allocated when a new cpu gets
detected.

The size of the pcpu_devices array (NR_CPUS * sizeof(struct pcpu)) gets
reduced by nearly 120KB.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 03439e7d
...@@ -59,7 +59,7 @@ enum { ...@@ -59,7 +59,7 @@ enum {
}; };
struct pcpu { struct pcpu {
struct cpu cpu; struct cpu *cpu;
struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ struct _lowcore *lowcore; /* lowcore page(s) for the cpu */
unsigned long async_stack; /* async stack for the cpu */ unsigned long async_stack; /* async stack for the cpu */
unsigned long panic_stack; /* panic stack for the cpu */ unsigned long panic_stack; /* panic stack for the cpu */
...@@ -958,7 +958,7 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action, ...@@ -958,7 +958,7 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action,
void *hcpu) void *hcpu)
{ {
unsigned int cpu = (unsigned int)(long)hcpu; unsigned int cpu = (unsigned int)(long)hcpu;
struct cpu *c = &pcpu_devices[cpu].cpu; struct cpu *c = pcpu_devices[cpu].cpu;
struct device *s = &c->dev; struct device *s = &c->dev;
int err = 0; int err = 0;
...@@ -975,10 +975,15 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action, ...@@ -975,10 +975,15 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action,
static int smp_add_present_cpu(int cpu) static int smp_add_present_cpu(int cpu)
{ {
struct cpu *c = &pcpu_devices[cpu].cpu; struct device *s;
struct device *s = &c->dev; struct cpu *c;
int rc; int rc;
c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c)
return -ENOMEM;
pcpu_devices[cpu].cpu = c;
s = &c->dev;
c->hotpluggable = 1; c->hotpluggable = 1;
rc = register_cpu(c, cpu); rc = register_cpu(c, cpu);
if (rc) if (rc)
......
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