diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2019-07-03 04:25:52 -0400 |
---|---|---|
committer | Dennis Zhou <dennis@kernel.org> | 2019-07-04 11:05:52 -0400 |
commit | 163fa23435cc9c705a71001d4aa15f3f945554a1 (patch) | |
tree | 768515474aec400ac567909c10ffa9973a28fae9 | |
parent | 6fbc7275c7a9ba97877050335f290341a1fd8dbf (diff) |
percpu: Make pcpu_setup_first_chunk() void function
pcpu_setup_first_chunk() will panic or BUG_ON if the are some
error and doesn't return any error, hence it can be defined to
return void.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
[Dennis: fixed kbuild warning for pcpu_page_first_chunk()]
-rw-r--r-- | arch/ia64/mm/contig.c | 5 | ||||
-rw-r--r-- | arch/ia64/mm/discontig.c | 5 | ||||
-rw-r--r-- | include/linux/percpu.h | 2 | ||||
-rw-r--r-- | mm/percpu.c | 19 |
4 files changed, 10 insertions, 21 deletions
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c index d29fb6b9fa33..db09a693f094 100644 --- a/arch/ia64/mm/contig.c +++ b/arch/ia64/mm/contig.c | |||
@@ -134,10 +134,7 @@ setup_per_cpu_areas(void) | |||
134 | ai->atom_size = PAGE_SIZE; | 134 | ai->atom_size = PAGE_SIZE; |
135 | ai->alloc_size = PERCPU_PAGE_SIZE; | 135 | ai->alloc_size = PERCPU_PAGE_SIZE; |
136 | 136 | ||
137 | rc = pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]); | 137 | pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]); |
138 | if (rc) | ||
139 | panic("failed to setup percpu area (err=%d)", rc); | ||
140 | |||
141 | pcpu_free_alloc_info(ai); | 138 | pcpu_free_alloc_info(ai); |
142 | } | 139 | } |
143 | #else | 140 | #else |
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 05490dd073e6..004dee231874 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c | |||
@@ -245,10 +245,7 @@ void __init setup_per_cpu_areas(void) | |||
245 | gi->cpu_map = &cpu_map[unit]; | 245 | gi->cpu_map = &cpu_map[unit]; |
246 | } | 246 | } |
247 | 247 | ||
248 | rc = pcpu_setup_first_chunk(ai, base); | 248 | pcpu_setup_first_chunk(ai, base); |
249 | if (rc) | ||
250 | panic("failed to setup percpu area (err=%d)", rc); | ||
251 | |||
252 | pcpu_free_alloc_info(ai); | 249 | pcpu_free_alloc_info(ai); |
253 | } | 250 | } |
254 | #endif | 251 | #endif |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 9909dc0e273a..5e76af742c80 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -105,7 +105,7 @@ extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups, | |||
105 | int nr_units); | 105 | int nr_units); |
106 | extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai); | 106 | extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai); |
107 | 107 | ||
108 | extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | 108 | extern void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, |
109 | void *base_addr); | 109 | void *base_addr); |
110 | 110 | ||
111 | #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK | 111 | #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK |
diff --git a/mm/percpu.c b/mm/percpu.c index 9821241fdede..5a918a4b1da0 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -2267,12 +2267,9 @@ static void pcpu_dump_alloc_info(const char *lvl, | |||
2267 | * share the same vm, but use offset regions in the area allocation map. | 2267 | * share the same vm, but use offset regions in the area allocation map. |
2268 | * The chunk serving the dynamic region is circulated in the chunk slots | 2268 | * The chunk serving the dynamic region is circulated in the chunk slots |
2269 | * and available for dynamic allocation like any other chunk. | 2269 | * and available for dynamic allocation like any other chunk. |
2270 | * | ||
2271 | * RETURNS: | ||
2272 | * 0 on success, -errno on failure. | ||
2273 | */ | 2270 | */ |
2274 | int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | 2271 | void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, |
2275 | void *base_addr) | 2272 | void *base_addr) |
2276 | { | 2273 | { |
2277 | size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size; | 2274 | size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size; |
2278 | size_t static_size, dyn_size; | 2275 | size_t static_size, dyn_size; |
@@ -2457,7 +2454,6 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
2457 | 2454 | ||
2458 | /* we're done */ | 2455 | /* we're done */ |
2459 | pcpu_base_addr = base_addr; | 2456 | pcpu_base_addr = base_addr; |
2460 | return 0; | ||
2461 | } | 2457 | } |
2462 | 2458 | ||
2463 | #ifdef CONFIG_SMP | 2459 | #ifdef CONFIG_SMP |
@@ -2710,7 +2706,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, | |||
2710 | struct pcpu_alloc_info *ai; | 2706 | struct pcpu_alloc_info *ai; |
2711 | size_t size_sum, areas_size; | 2707 | size_t size_sum, areas_size; |
2712 | unsigned long max_distance; | 2708 | unsigned long max_distance; |
2713 | int group, i, highest_group, rc; | 2709 | int group, i, highest_group, rc = 0; |
2714 | 2710 | ||
2715 | ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size, | 2711 | ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size, |
2716 | cpu_distance_fn); | 2712 | cpu_distance_fn); |
@@ -2795,7 +2791,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, | |||
2795 | PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, | 2791 | PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, |
2796 | ai->dyn_size, ai->unit_size); | 2792 | ai->dyn_size, ai->unit_size); |
2797 | 2793 | ||
2798 | rc = pcpu_setup_first_chunk(ai, base); | 2794 | pcpu_setup_first_chunk(ai, base); |
2799 | goto out_free; | 2795 | goto out_free; |
2800 | 2796 | ||
2801 | out_free_areas: | 2797 | out_free_areas: |
@@ -2839,7 +2835,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size, | |||
2839 | int unit_pages; | 2835 | int unit_pages; |
2840 | size_t pages_size; | 2836 | size_t pages_size; |
2841 | struct page **pages; | 2837 | struct page **pages; |
2842 | int unit, i, j, rc; | 2838 | int unit, i, j, rc = 0; |
2843 | int upa; | 2839 | int upa; |
2844 | int nr_g0_units; | 2840 | int nr_g0_units; |
2845 | 2841 | ||
@@ -2920,7 +2916,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size, | |||
2920 | unit_pages, psize_str, ai->static_size, | 2916 | unit_pages, psize_str, ai->static_size, |
2921 | ai->reserved_size, ai->dyn_size); | 2917 | ai->reserved_size, ai->dyn_size); |
2922 | 2918 | ||
2923 | rc = pcpu_setup_first_chunk(ai, vm.addr); | 2919 | pcpu_setup_first_chunk(ai, vm.addr); |
2924 | goto out_free_ar; | 2920 | goto out_free_ar; |
2925 | 2921 | ||
2926 | enomem: | 2922 | enomem: |
@@ -3014,8 +3010,7 @@ void __init setup_per_cpu_areas(void) | |||
3014 | ai->groups[0].nr_units = 1; | 3010 | ai->groups[0].nr_units = 1; |
3015 | ai->groups[0].cpu_map[0] = 0; | 3011 | ai->groups[0].cpu_map[0] = 0; |
3016 | 3012 | ||
3017 | if (pcpu_setup_first_chunk(ai, fc) < 0) | 3013 | pcpu_setup_first_chunk(ai, fc); |
3018 | panic("Failed to initialize percpu areas."); | ||
3019 | pcpu_free_alloc_info(ai); | 3014 | pcpu_free_alloc_info(ai); |
3020 | } | 3015 | } |
3021 | 3016 | ||