Skip to content

Commit

Permalink
s390/smp: reduce memory consumption of pcpu_devices array
Browse files Browse the repository at this point in the history
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: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Dec 16, 2013
1 parent 03439e7 commit 96619fc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arch/s390/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum {
};

struct pcpu {
struct cpu cpu;
struct cpu *cpu;
struct _lowcore *lowcore; /* lowcore page(s) for the cpu */
unsigned long async_stack; /* async stack for the cpu */
unsigned long panic_stack; /* panic stack for the cpu */
Expand Down Expand Up @@ -958,7 +958,7 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action,
void *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;
int err = 0;

Expand All @@ -975,10 +975,15 @@ static int smp_cpu_notify(struct notifier_block *self, unsigned long action,

static int smp_add_present_cpu(int cpu)
{
struct cpu *c = &pcpu_devices[cpu].cpu;
struct device *s = &c->dev;
struct device *s;
struct cpu *c;
int rc;

c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c)
return -ENOMEM;
pcpu_devices[cpu].cpu = c;
s = &c->dev;
c->hotpluggable = 1;
rc = register_cpu(c, cpu);
if (rc)
Expand Down

0 comments on commit 96619fc

Please sign in to comment.