diff options
-rw-r--r-- | arch/x86/Kconfig | 10 | ||||
-rw-r--r-- | include/linux/percpu.h | 27 | ||||
-rw-r--r-- | mm/percpu.c | 19 |
3 files changed, 26 insertions, 30 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index e06b2eeff9f2..f7ac27215512 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -150,6 +150,16 @@ config ARCH_HAS_CACHE_LINE_SIZE | |||
150 | config HAVE_SETUP_PER_CPU_AREA | 150 | config HAVE_SETUP_PER_CPU_AREA |
151 | def_bool y | 151 | def_bool y |
152 | 152 | ||
153 | config NEED_PER_CPU_EMBED_FIRST_CHUNK | ||
154 | def_bool y | ||
155 | |||
156 | config NEED_PER_CPU_PAGE_FIRST_CHUNK | ||
157 | def_bool y | ||
158 | |||
159 | config NEED_PER_CPU_LPAGE_FIRST_CHUNK | ||
160 | def_bool y | ||
161 | depends on NEED_MULTIPLE_NODES | ||
162 | |||
153 | config HAVE_CPUMASK_OF_CPU_MAP | 163 | config HAVE_CPUMASK_OF_CPU_MAP |
154 | def_bool X86_64_SMP | 164 | def_bool X86_64_SMP |
155 | 165 | ||
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 7989f61b03f3..e26788e0da4a 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -70,17 +70,21 @@ extern size_t __init pcpu_setup_first_chunk( | |||
70 | ssize_t dyn_size, size_t unit_size, | 70 | ssize_t dyn_size, size_t unit_size, |
71 | void *base_addr, const int *unit_map); | 71 | void *base_addr, const int *unit_map); |
72 | 72 | ||
73 | #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK | ||
73 | extern ssize_t __init pcpu_embed_first_chunk( | 74 | extern ssize_t __init pcpu_embed_first_chunk( |
74 | size_t static_size, size_t reserved_size, | 75 | size_t static_size, size_t reserved_size, |
75 | ssize_t dyn_size); | 76 | ssize_t dyn_size); |
77 | #endif | ||
76 | 78 | ||
79 | #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK | ||
77 | extern ssize_t __init pcpu_page_first_chunk( | 80 | extern ssize_t __init pcpu_page_first_chunk( |
78 | size_t static_size, size_t reserved_size, | 81 | size_t static_size, size_t reserved_size, |
79 | pcpu_fc_alloc_fn_t alloc_fn, | 82 | pcpu_fc_alloc_fn_t alloc_fn, |
80 | pcpu_fc_free_fn_t free_fn, | 83 | pcpu_fc_free_fn_t free_fn, |
81 | pcpu_fc_populate_pte_fn_t populate_pte_fn); | 84 | pcpu_fc_populate_pte_fn_t populate_pte_fn); |
85 | #endif | ||
82 | 86 | ||
83 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 87 | #ifdef CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK |
84 | extern int __init pcpu_lpage_build_unit_map( | 88 | extern int __init pcpu_lpage_build_unit_map( |
85 | size_t static_size, size_t reserved_size, | 89 | size_t static_size, size_t reserved_size, |
86 | ssize_t *dyn_sizep, size_t *unit_sizep, | 90 | ssize_t *dyn_sizep, size_t *unit_sizep, |
@@ -98,27 +102,6 @@ extern ssize_t __init pcpu_lpage_first_chunk( | |||
98 | 102 | ||
99 | extern void *pcpu_lpage_remapped(void *kaddr); | 103 | extern void *pcpu_lpage_remapped(void *kaddr); |
100 | #else | 104 | #else |
101 | static inline int pcpu_lpage_build_unit_map( | ||
102 | size_t static_size, size_t reserved_size, | ||
103 | ssize_t *dyn_sizep, size_t *unit_sizep, | ||
104 | size_t lpage_size, int *unit_map, | ||
105 | pcpu_fc_cpu_distance_fn_t cpu_distance_fn) | ||
106 | { | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | |||
110 | static inline ssize_t __init pcpu_lpage_first_chunk( | ||
111 | size_t static_size, size_t reserved_size, | ||
112 | size_t dyn_size, size_t unit_size, | ||
113 | size_t lpage_size, const int *unit_map, | ||
114 | int nr_units, | ||
115 | pcpu_fc_alloc_fn_t alloc_fn, | ||
116 | pcpu_fc_free_fn_t free_fn, | ||
117 | pcpu_fc_map_fn_t map_fn) | ||
118 | { | ||
119 | return -EINVAL; | ||
120 | } | ||
121 | |||
122 | static inline void *pcpu_lpage_remapped(void *kaddr) | 105 | static inline void *pcpu_lpage_remapped(void *kaddr) |
123 | { | 106 | { |
124 | return NULL; | 107 | return NULL; |
diff --git a/mm/percpu.c b/mm/percpu.c index 6feac7934904..7971997de310 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1414,8 +1414,9 @@ size_t __init pcpu_setup_first_chunk(size_t static_size, size_t reserved_size, | |||
1414 | return pcpu_unit_size; | 1414 | return pcpu_unit_size; |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | static size_t pcpu_calc_fc_sizes(size_t static_size, size_t reserved_size, | 1417 | static inline size_t pcpu_calc_fc_sizes(size_t static_size, |
1418 | ssize_t *dyn_sizep) | 1418 | size_t reserved_size, |
1419 | ssize_t *dyn_sizep) | ||
1419 | { | 1420 | { |
1420 | size_t size_sum; | 1421 | size_t size_sum; |
1421 | 1422 | ||
@@ -1427,6 +1428,8 @@ static size_t pcpu_calc_fc_sizes(size_t static_size, size_t reserved_size, | |||
1427 | return size_sum; | 1428 | return size_sum; |
1428 | } | 1429 | } |
1429 | 1430 | ||
1431 | #if defined(CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK) || \ | ||
1432 | !defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) | ||
1430 | /** | 1433 | /** |
1431 | * pcpu_embed_first_chunk - embed the first percpu chunk into bootmem | 1434 | * pcpu_embed_first_chunk - embed the first percpu chunk into bootmem |
1432 | * @static_size: the size of static percpu area in bytes | 1435 | * @static_size: the size of static percpu area in bytes |
@@ -1495,7 +1498,10 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size, | |||
1495 | return pcpu_setup_first_chunk(static_size, reserved_size, dyn_size, | 1498 | return pcpu_setup_first_chunk(static_size, reserved_size, dyn_size, |
1496 | unit_size, base, NULL); | 1499 | unit_size, base, NULL); |
1497 | } | 1500 | } |
1501 | #endif /* CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK || | ||
1502 | !CONFIG_HAVE_SETUP_PER_CPU_AREA */ | ||
1498 | 1503 | ||
1504 | #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK | ||
1499 | /** | 1505 | /** |
1500 | * pcpu_page_first_chunk - map the first chunk using PAGE_SIZE pages | 1506 | * pcpu_page_first_chunk - map the first chunk using PAGE_SIZE pages |
1501 | * @static_size: the size of static percpu area in bytes | 1507 | * @static_size: the size of static percpu area in bytes |
@@ -1598,12 +1604,9 @@ out_free_ar: | |||
1598 | free_bootmem(__pa(pages), pages_size); | 1604 | free_bootmem(__pa(pages), pages_size); |
1599 | return ret; | 1605 | return ret; |
1600 | } | 1606 | } |
1607 | #endif /* CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK */ | ||
1601 | 1608 | ||
1602 | /* | 1609 | #ifdef CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK |
1603 | * Large page remapping first chunk setup helper | ||
1604 | */ | ||
1605 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
1606 | |||
1607 | /** | 1610 | /** |
1608 | * pcpu_lpage_build_unit_map - build unit_map for large page remapping | 1611 | * pcpu_lpage_build_unit_map - build unit_map for large page remapping |
1609 | * @static_size: the size of static percpu area in bytes | 1612 | * @static_size: the size of static percpu area in bytes |
@@ -1982,7 +1985,7 @@ void *pcpu_lpage_remapped(void *kaddr) | |||
1982 | 1985 | ||
1983 | return NULL; | 1986 | return NULL; |
1984 | } | 1987 | } |
1985 | #endif | 1988 | #endif /* CONFIG_NEED_PER_CPU_LPAGE_FIRST_CHUNK */ |
1986 | 1989 | ||
1987 | /* | 1990 | /* |
1988 | * Generic percpu area setup. | 1991 | * Generic percpu area setup. |