diff options
author | Tejun Heo <tj@kernel.org> | 2009-03-06 00:33:58 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-03-06 00:33:58 -0500 |
commit | 6a242909b01120f6f3d571c0b75e20ec61f0d8d3 (patch) | |
tree | 30688c18508f7ad0fe7b725e502c1e85fe33e7e5 /include/linux/percpu.h | |
parent | f254f3909efaf59ca2d0f408de2d044dace60706 (diff) |
percpu: clean up percpu constants
Impact: cleaup
Make the following cleanups.
* There isn't much arch-specific about PERCPU_MODULE_RESERVE. Always
define it whether arch overrides PERCPU_ENOUGH_ROOM or not.
* blackfin overrides PERCPU_ENOUGH_ROOM to align static area size. Do
it by default.
* percpu allocation sizes doesn't have much to do with the page size.
Don't use PAGE_SHIFT in their definition.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r-- | include/linux/percpu.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 545b068bcb70..2d34b038fe70 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/slab.h> /* For kmalloc() */ | 5 | #include <linux/slab.h> /* For kmalloc() */ |
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <linux/pfn.h> | ||
8 | 9 | ||
9 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
10 | 11 | ||
@@ -52,17 +53,18 @@ | |||
52 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 53 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
53 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 54 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) |
54 | 55 | ||
55 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ | 56 | /* enough to cover all DEFINE_PER_CPUs in modules */ |
56 | #ifndef PERCPU_ENOUGH_ROOM | ||
57 | #ifdef CONFIG_MODULES | 57 | #ifdef CONFIG_MODULES |
58 | #define PERCPU_MODULE_RESERVE 8192 | 58 | #define PERCPU_MODULE_RESERVE (8 << 10) |
59 | #else | 59 | #else |
60 | #define PERCPU_MODULE_RESERVE 0 | 60 | #define PERCPU_MODULE_RESERVE 0 |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #ifndef PERCPU_ENOUGH_ROOM | ||
63 | #define PERCPU_ENOUGH_ROOM \ | 64 | #define PERCPU_ENOUGH_ROOM \ |
64 | (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) | 65 | (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ |
65 | #endif /* PERCPU_ENOUGH_ROOM */ | 66 | PERCPU_MODULE_RESERVE) |
67 | #endif | ||
66 | 68 | ||
67 | /* | 69 | /* |
68 | * Must be an lvalue. Since @var must be a simple identifier, | 70 | * Must be an lvalue. Since @var must be a simple identifier, |
@@ -79,7 +81,7 @@ | |||
79 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | 81 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA |
80 | 82 | ||
81 | /* minimum unit size, also is the maximum supported allocation size */ | 83 | /* minimum unit size, also is the maximum supported allocation size */ |
82 | #define PCPU_MIN_UNIT_SIZE (16UL << PAGE_SHIFT) | 84 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) |
83 | 85 | ||
84 | /* | 86 | /* |
85 | * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy | 87 | * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy |
@@ -96,15 +98,15 @@ | |||
96 | #ifndef PERCPU_DYNAMIC_RESERVE | 98 | #ifndef PERCPU_DYNAMIC_RESERVE |
97 | # if BITS_PER_LONG > 32 | 99 | # if BITS_PER_LONG > 32 |
98 | # ifdef CONFIG_MODULES | 100 | # ifdef CONFIG_MODULES |
99 | # define PERCPU_DYNAMIC_RESERVE (6 << PAGE_SHIFT) | 101 | # define PERCPU_DYNAMIC_RESERVE (24 << 10) |
100 | # else | 102 | # else |
101 | # define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT) | 103 | # define PERCPU_DYNAMIC_RESERVE (16 << 10) |
102 | # endif | 104 | # endif |
103 | # else | 105 | # else |
104 | # ifdef CONFIG_MODULES | 106 | # ifdef CONFIG_MODULES |
105 | # define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT) | 107 | # define PERCPU_DYNAMIC_RESERVE (16 << 10) |
106 | # else | 108 | # else |
107 | # define PERCPU_DYNAMIC_RESERVE (2 << PAGE_SHIFT) | 109 | # define PERCPU_DYNAMIC_RESERVE (8 << 10) |
108 | # endif | 110 | # endif |
109 | # endif | 111 | # endif |
110 | #endif /* PERCPU_DYNAMIC_RESERVE */ | 112 | #endif /* PERCPU_DYNAMIC_RESERVE */ |