Skip to content

Commit 204fba4

Browse files
committed
percpu: cleanup percpu array definitions
Currently, the following three different ways to define percpu arrays are in use. 1. DEFINE_PER_CPU(elem_type[array_len], array_name); 2. DEFINE_PER_CPU(elem_type, array_name[array_len]); 3. DEFINE_PER_CPU(elem_type, array_name)[array_len]; Unify to raspberrypi#1 which correctly separates the roles of the two parameters and thus allows more flexibility in the way percpu variables are defined. [ Impact: cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Tony Luck <tony.luck@intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: linux-mm@kvack.org Cc: Christoph Lameter <cl@linux-foundation.org> Cc: David S. Miller <davem@davemloft.net>
1 parent fe87f94 commit 204fba4

12 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎arch/ia64/kernel/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static struct local_tlb_flush_counts {
5858
unsigned int count;
5959
} __attribute__((__aligned__(32))) local_tlb_flush_counts[NR_CPUS];
6060

61-
static DEFINE_PER_CPU(unsigned short, shadow_flush_counts[NR_CPUS]) ____cacheline_aligned;
61+
static DEFINE_PER_CPU(unsigned short [NR_CPUS], shadow_flush_counts) ____cacheline_aligned;
6262

6363
#define IPI_CALL_FUNC 0
6464
#define IPI_CPU_STOP 1

‎arch/ia64/sn/kernel/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
7171
DEFINE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
7272
EXPORT_PER_CPU_SYMBOL(__sn_hub_info);
7373

74-
DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
74+
DEFINE_PER_CPU(short [MAX_COMPACT_NODES], __sn_cnodeid_to_nasid);
7575
EXPORT_PER_CPU_SYMBOL(__sn_cnodeid_to_nasid);
7676

7777
DEFINE_PER_CPU(struct nodepda_s *, __sn_nodepda);

‎arch/powerpc/mm/stab.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct stab_entry {
3131

3232
#define NR_STAB_CACHE_ENTRIES 8
3333
static DEFINE_PER_CPU(long, stab_cache_ptr);
34-
static DEFINE_PER_CPU(long, stab_cache[NR_STAB_CACHE_ENTRIES]);
34+
static DEFINE_PER_CPU(long [NR_STAB_CACHE_ENTRIES], stab_cache);
3535

3636
/*
3737
* Create a segment table entry for the given esid/vsid pair.

‎arch/powerpc/platforms/ps3/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838

3939
#define MSG_COUNT 4
40-
static DEFINE_PER_CPU(unsigned int, ps3_ipi_virqs[MSG_COUNT]);
40+
static DEFINE_PER_CPU(unsigned int [MSG_COUNT], ps3_ipi_virqs);
4141

4242
static void do_message_pass(int target, int msg)
4343
{

‎arch/x86/kernel/cpu/cpu_debug.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <asm/apic.h>
3131
#include <asm/desc.h>
3232

33-
static DEFINE_PER_CPU(struct cpu_cpuX_base, cpu_arr[CPU_REG_ALL_BIT]);
34-
static DEFINE_PER_CPU(struct cpu_private *, priv_arr[MAX_CPU_FILES]);
33+
static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpu_arr);
34+
static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], priv_arr);
3535
static DEFINE_PER_CPU(int, cpu_priv_count);
3636

3737
static DEFINE_MUTEX(cpu_debug_lock);

‎arch/x86/kernel/cpu/mcheck/mce_amd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct threshold_bank {
6969
struct threshold_block *blocks;
7070
cpumask_var_t cpus;
7171
};
72-
static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]);
72+
static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks);
7373

7474
#ifdef CONFIG_SMP
7575
static unsigned char shared_bank[NR_BANKS] = {

‎arch/x86/kernel/cpu/perf_counter.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ amd_pmu_disable_counter(struct hw_perf_counter *hwc, int idx)
862862
x86_pmu_disable_counter(hwc, idx);
863863
}
864864

865-
static DEFINE_PER_CPU(u64, prev_left[X86_PMC_IDX_MAX]);
865+
static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], prev_left);
866866

867867
/*
868868
* Set the next IRQ period, based on the hwc->period_left value.

‎drivers/xen/events.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
static DEFINE_SPINLOCK(irq_mapping_update_lock);
4848

4949
/* IRQ <-> VIRQ mapping. */
50-
static DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1};
50+
static DEFINE_PER_CPU(int [NR_VIRQS], virq_to_irq) = {[0 ... NR_VIRQS-1] = -1};
5151

5252
/* IRQ <-> IPI mapping */
53-
static DEFINE_PER_CPU(int, ipi_to_irq[XEN_NR_IPIS]) = {[0 ... XEN_NR_IPIS-1] = -1};
53+
static DEFINE_PER_CPU(int [XEN_NR_IPIS], ipi_to_irq) = {[0 ... XEN_NR_IPIS-1] = -1};
5454

5555
/* Interrupt types. */
5656
enum xen_irq_type {

‎mm/quicklist.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/module.h>
2020
#include <linux/quicklist.h>
2121

22-
DEFINE_PER_CPU(struct quicklist, quicklist)[CONFIG_NR_QUICK];
22+
DEFINE_PER_CPU(struct quicklist [CONFIG_NR_QUICK], quicklist);
2323

2424
#define FRACTION_OF_NODE_MEM 16
2525

‎mm/slub.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,8 +2086,8 @@ init_kmem_cache_node(struct kmem_cache_node *n, struct kmem_cache *s)
20862086
*/
20872087
#define NR_KMEM_CACHE_CPU 100
20882088

2089-
static DEFINE_PER_CPU(struct kmem_cache_cpu,
2090-
kmem_cache_cpu)[NR_KMEM_CACHE_CPU];
2089+
static DEFINE_PER_CPU(struct kmem_cache_cpu [NR_KMEM_CACHE_CPU],
2090+
kmem_cache_cpu);
20912091

20922092
static DEFINE_PER_CPU(struct kmem_cache_cpu *, kmem_cache_cpu_free);
20932093
static DECLARE_BITMAP(kmem_cach_cpu_free_init_once, CONFIG_NR_CPUS);

0 commit comments

Comments
 (0)