aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-alpha/percpu.h14
-rw-r--r--include/asm-sparc64/percpu.h10
-rw-r--r--include/asm-x86_64/percpu.h10
-rw-r--r--include/linux/percpu.h9
-rw-r--r--kernel/module.c2
5 files changed, 9 insertions, 36 deletions
diff --git a/include/asm-alpha/percpu.h b/include/asm-alpha/percpu.h
index 651ebb141b24..48348fe34c19 100644
--- a/include/asm-alpha/percpu.h
+++ b/include/asm-alpha/percpu.h
@@ -1,20 +1,6 @@
1#ifndef __ALPHA_PERCPU_H 1#ifndef __ALPHA_PERCPU_H
2#define __ALPHA_PERCPU_H 2#define __ALPHA_PERCPU_H
3 3
4/*
5 * Increase the per cpu area for Alpha so that
6 * modules using percpu area can load.
7 */
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
18#include <asm-generic/percpu.h> 4#include <asm-generic/percpu.h>
19 5
20#endif /* __ALPHA_PERCPU_H */ 6#endif /* __ALPHA_PERCPU_H */
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index 0d3df76aa47f..ced8cbde046d 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -5,16 +5,6 @@
5 5
6#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
7 7
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
18extern void setup_per_cpu_areas(void); 8extern void setup_per_cpu_areas(void);
19 9
20extern unsigned long __per_cpu_base; 10extern unsigned long __per_cpu_base;
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 5ed0ef340842..c6fbb67eac90 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,16 +11,6 @@
11 11
12#include <asm/pda.h> 12#include <asm/pda.h>
13 13
14#ifdef CONFIG_MODULES
15# define PERCPU_MODULE_RESERVE 8192
16#else
17# define PERCPU_MODULE_RESERVE 0
18#endif
19
20#define PERCPU_ENOUGH_ROOM \
21 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
22 PERCPU_MODULE_RESERVE)
23
24#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) 14#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
25#define __my_cpu_offset() read_pda(data_offset) 15#define __my_cpu_offset() read_pda(data_offset)
26 16
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 600e3d387ffc..b72be2f79e6a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -11,9 +11,16 @@
11 11
12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
13#ifndef PERCPU_ENOUGH_ROOM 13#ifndef PERCPU_ENOUGH_ROOM
14#define PERCPU_ENOUGH_ROOM 32768 14#ifdef CONFIG_MODULES
15#define PERCPU_MODULE_RESERVE 8192
16#else
17#define PERCPU_MODULE_RESERVE 0
15#endif 18#endif
16 19
20#define PERCPU_ENOUGH_ROOM \
21 (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE)
22#endif /* PERCPU_ENOUGH_ROOM */
23
17/* 24/*
18 * Must be an lvalue. Since @var must be a simple identifier, 25 * Must be an lvalue. Since @var must be a simple identifier,
19 * we force a syntax error here if it isn't. 26 * we force a syntax error here if it isn't.
diff --git a/kernel/module.c b/kernel/module.c
index 9da5af668a20..cf49ca25fcce 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -430,7 +430,7 @@ static int percpu_modinit(void)
430 pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated, 430 pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated,
431 GFP_KERNEL); 431 GFP_KERNEL);
432 /* Static in-kernel percpu data (used). */ 432 /* Static in-kernel percpu data (used). */
433 pcpu_size[0] = -ALIGN(__per_cpu_end-__per_cpu_start, SMP_CACHE_BYTES); 433 pcpu_size[0] = -(__per_cpu_end-__per_cpu_start);
434 /* Free room. */ 434 /* Free room. */
435 pcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0]; 435 pcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0];
436 if (pcpu_size[1] < 0) { 436 if (pcpu_size[1] < 0) {