summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-12-05 12:42:09 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-12-16 14:37:46 +0100
commit96619fc1b3d06703113ab4c5cd8c15f35a42dc99 (patch)
treed18560fb13cde7f780edc6069df05a8d6349ce5a
parent03439e7d0a7ab3d77a74523b9ba64736c0fc28de (diff)
downloadkernel-common-96619fc1b3d06703113ab4c5cd8c15f35a42dc99.tar.gz
kernel-common-96619fc1b3d06703113ab4c5cd8c15f35a42dc99.tar.bz2
kernel-common-96619fc1b3d06703113ab4c5cd8c15f35a42dc99.zip
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: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/smp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 86b291323c62..8ceefc949e8f 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -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 */
@@ -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;
@@ -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)