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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull percpu fix and cleanup from Dennis Zhou:
"A fix for a Wshadow warning in the asm-generic percpu macros came in
and then I tacked on the removal of flexible array initializers in the
percpu allocator"

* 'for-5.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu:
percpu: convert flexible array initializers to use struct_size()
asm-generic: percpu: avoid Wshadow warning

+13 -13
+9 -9
include/asm-generic/percpu.h
··· 114 114 115 115 #define __this_cpu_generic_read_nopreempt(pcp) \ 116 116 ({ \ 117 - typeof(pcp) __ret; \ 117 + typeof(pcp) ___ret; \ 118 118 preempt_disable_notrace(); \ 119 - __ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ 119 + ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ 120 120 preempt_enable_notrace(); \ 121 - __ret; \ 121 + ___ret; \ 122 122 }) 123 123 124 124 #define __this_cpu_generic_read_noirq(pcp) \ 125 125 ({ \ 126 - typeof(pcp) __ret; \ 127 - unsigned long __flags; \ 128 - raw_local_irq_save(__flags); \ 129 - __ret = raw_cpu_generic_read(pcp); \ 130 - raw_local_irq_restore(__flags); \ 131 - __ret; \ 126 + typeof(pcp) ___ret; \ 127 + unsigned long ___flags; \ 128 + raw_local_irq_save(___flags); \ 129 + ___ret = raw_cpu_generic_read(pcp); \ 130 + raw_local_irq_restore(___flags); \ 131 + ___ret; \ 132 132 }) 133 133 134 134 #define this_cpu_generic_read(pcp) \
+4 -4
mm/percpu.c
··· 1315 1315 region_size = ALIGN(start_offset + map_size, lcm_align); 1316 1316 1317 1317 /* allocate chunk */ 1318 - alloc_size = sizeof(struct pcpu_chunk) + 1319 - BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long); 1318 + alloc_size = struct_size(chunk, populated, 1319 + BITS_TO_LONGS(region_size >> PAGE_SHIFT)); 1320 1320 chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES); 1321 1321 if (!chunk) 1322 1322 panic("%s: Failed to allocate %zu bytes\n", __func__, ··· 2521 2521 pcpu_unit_pages = ai->unit_size >> PAGE_SHIFT; 2522 2522 pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; 2523 2523 pcpu_atom_size = ai->atom_size; 2524 - pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) + 2525 - BITS_TO_LONGS(pcpu_unit_pages) * sizeof(unsigned long); 2524 + pcpu_chunk_struct_size = struct_size(chunk, populated, 2525 + BITS_TO_LONGS(pcpu_unit_pages)); 2526 2526 2527 2527 pcpu_stats_save_ai(ai); 2528 2528