Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu

Pull percpu updates from Dennis Zhou:
"A couple of updates to clean up the code with no change in behavior"

* 'for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu:
percpu: Use struct_size() helper
percpu: fix typo in pcpu_setup_first_chunk() comment
percpu: Make pcpu_setup_first_chunk() void function

+12 -23
+1 -4
arch/ia64/mm/contig.c
··· 134 134 ai->atom_size = PAGE_SIZE; 135 135 ai->alloc_size = PERCPU_PAGE_SIZE; 136 136 137 - rc = 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 - 137 + pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]); 141 138 pcpu_free_alloc_info(ai); 142 139 } 143 140 #else
+1 -4
arch/ia64/mm/discontig.c
··· 245 245 gi->cpu_map = &cpu_map[unit]; 246 246 } 247 247 248 - rc = pcpu_setup_first_chunk(ai, base); 249 - if (rc) 250 - panic("failed to setup percpu area (err=%d)", rc); 251 - 248 + pcpu_setup_first_chunk(ai, base); 252 249 pcpu_free_alloc_info(ai); 253 250 } 254 251 #endif
+1 -1
include/linux/percpu.h
··· 105 105 int nr_units); 106 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 109 void *base_addr); 110 110 111 111 #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
+9 -14
mm/percpu.c
··· 2125 2125 void *ptr; 2126 2126 int unit; 2127 2127 2128 - base_size = ALIGN(sizeof(*ai) + nr_groups * sizeof(ai->groups[0]), 2128 + base_size = ALIGN(struct_size(ai, groups, nr_groups), 2129 2129 __alignof__(ai->groups[0].cpu_map[0])); 2130 2130 ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]); 2131 2131 ··· 2220 2220 * @base_addr: mapped address 2221 2221 * 2222 2222 * Initialize the first percpu chunk which contains the kernel static 2223 - * perpcu area. This function is to be called from arch percpu area 2223 + * percpu area. This function is to be called from arch percpu area 2224 2224 * setup path. 2225 2225 * 2226 2226 * @ai contains all information necessary to initialize the first ··· 2267 2267 * share the same vm, but use offset regions in the area allocation map. 2268 2268 * The chunk serving the dynamic region is circulated in the chunk slots 2269 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, 2275 - void *base_addr) 2271 + void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, 2272 + void *base_addr) 2276 2273 { 2277 2274 size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size; 2278 2275 size_t static_size, dyn_size; ··· 2454 2457 2455 2458 /* we're done */ 2456 2459 pcpu_base_addr = base_addr; 2457 - return 0; 2458 2460 } 2459 2461 2460 2462 #ifdef CONFIG_SMP ··· 2706 2710 struct pcpu_alloc_info *ai; 2707 2711 size_t size_sum, areas_size; 2708 2712 unsigned long max_distance; 2709 - int group, i, highest_group, rc; 2713 + int group, i, highest_group, rc = 0; 2710 2714 2711 2715 ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size, 2712 2716 cpu_distance_fn); ··· 2791 2795 PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, 2792 2796 ai->dyn_size, ai->unit_size); 2793 2797 2794 - rc = pcpu_setup_first_chunk(ai, base); 2798 + pcpu_setup_first_chunk(ai, base); 2795 2799 goto out_free; 2796 2800 2797 2801 out_free_areas: ··· 2835 2839 int unit_pages; 2836 2840 size_t pages_size; 2837 2841 struct page **pages; 2838 - int unit, i, j, rc; 2842 + int unit, i, j, rc = 0; 2839 2843 int upa; 2840 2844 int nr_g0_units; 2841 2845 ··· 2916 2920 unit_pages, psize_str, ai->static_size, 2917 2921 ai->reserved_size, ai->dyn_size); 2918 2922 2919 - rc = pcpu_setup_first_chunk(ai, vm.addr); 2923 + pcpu_setup_first_chunk(ai, vm.addr); 2920 2924 goto out_free_ar; 2921 2925 2922 2926 enomem: ··· 3010 3014 ai->groups[0].nr_units = 1; 3011 3015 ai->groups[0].cpu_map[0] = 0; 3012 3016 3013 - if (pcpu_setup_first_chunk(ai, fc) < 0) 3014 - panic("Failed to initialize percpu areas."); 3017 + pcpu_setup_first_chunk(ai, fc); 3015 3018 pcpu_free_alloc_info(ai); 3016 3019 } 3017 3020