Commit a50cf159 authored by Linus Torvalds's avatar Linus Torvalds

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
parents e28c0d7c 61cf93d3
...@@ -114,21 +114,21 @@ do { \ ...@@ -114,21 +114,21 @@ do { \
#define __this_cpu_generic_read_nopreempt(pcp) \ #define __this_cpu_generic_read_nopreempt(pcp) \
({ \ ({ \
typeof(pcp) __ret; \ typeof(pcp) ___ret; \
preempt_disable_notrace(); \ preempt_disable_notrace(); \
__ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
preempt_enable_notrace(); \ preempt_enable_notrace(); \
__ret; \ ___ret; \
}) })
#define __this_cpu_generic_read_noirq(pcp) \ #define __this_cpu_generic_read_noirq(pcp) \
({ \ ({ \
typeof(pcp) __ret; \ typeof(pcp) ___ret; \
unsigned long __flags; \ unsigned long ___flags; \
raw_local_irq_save(__flags); \ raw_local_irq_save(___flags); \
__ret = raw_cpu_generic_read(pcp); \ ___ret = raw_cpu_generic_read(pcp); \
raw_local_irq_restore(__flags); \ raw_local_irq_restore(___flags); \
__ret; \ ___ret; \
}) })
#define this_cpu_generic_read(pcp) \ #define this_cpu_generic_read(pcp) \
......
...@@ -1315,8 +1315,8 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr, ...@@ -1315,8 +1315,8 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
region_size = ALIGN(start_offset + map_size, lcm_align); region_size = ALIGN(start_offset + map_size, lcm_align);
/* allocate chunk */ /* allocate chunk */
alloc_size = sizeof(struct pcpu_chunk) + alloc_size = struct_size(chunk, populated,
BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long); BITS_TO_LONGS(region_size >> PAGE_SHIFT));
chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES); chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
if (!chunk) if (!chunk)
panic("%s: Failed to allocate %zu bytes\n", __func__, panic("%s: Failed to allocate %zu bytes\n", __func__,
...@@ -2521,8 +2521,8 @@ void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, ...@@ -2521,8 +2521,8 @@ void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
pcpu_unit_pages = ai->unit_size >> PAGE_SHIFT; pcpu_unit_pages = ai->unit_size >> PAGE_SHIFT;
pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT;
pcpu_atom_size = ai->atom_size; pcpu_atom_size = ai->atom_size;
pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) + pcpu_chunk_struct_size = struct_size(chunk, populated,
BITS_TO_LONGS(pcpu_unit_pages) * sizeof(unsigned long); BITS_TO_LONGS(pcpu_unit_pages));
pcpu_stats_save_ai(ai); pcpu_stats_save_ai(ai);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment