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

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

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (34 commits)
m68k: rename global variable vmalloc_end to m68k_vmalloc_end
percpu: add missing per_cpu_ptr_to_phys() definition for UP
percpu: Fix kdump failure if booted with percpu_alloc=page
percpu: make misc percpu symbols unique
percpu: make percpu symbols in ia64 unique
percpu: make percpu symbols in powerpc unique
percpu: make percpu symbols in x86 unique
percpu: make percpu symbols in xen unique
percpu: make percpu symbols in cpufreq unique
percpu: make percpu symbols in oprofile unique
percpu: make percpu symbols in tracer unique
percpu: make percpu symbols under kernel/ and mm/ unique
percpu: remove some sparse warnings
percpu: make alloc_percpu() handle array types
vmalloc: fix use of non-existent percpu variable in put_cpu_var()
this_cpu: Use this_cpu_xx in trace_functions_graph.c
this_cpu: Use this_cpu_xx for ftrace
this_cpu: Use this_cpu_xx in nmi handling
this_cpu: Use this_cpu operations in RCU
this_cpu: Use this_cpu ops for VM statistics
...

Fix up trivial (famous last words) global per-cpu naming conflicts in
arch/x86/kvm/svm.c
mm/slab.c

+1222 -978
-3
arch/ia64/Kconfig
··· 87 87 bool 88 88 default y 89 89 90 - config HAVE_LEGACY_PER_CPU_AREA 91 - def_bool y 92 - 93 90 config HAVE_SETUP_PER_CPU_AREA 94 91 def_bool y 95 92
+1 -1
arch/ia64/include/asm/meminit.h
··· 61 61 62 62 #ifdef CONFIG_VIRTUAL_MEM_MAP 63 63 # define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */ 64 - extern unsigned long vmalloc_end; 64 + extern unsigned long VMALLOC_END; 65 65 extern struct page *vmem_map; 66 66 extern int find_largest_hole(u64 start, u64 end, void *arg); 67 67 extern int create_mem_map_page_table(u64 start, u64 end, void *arg);
+1 -2
arch/ia64/include/asm/pgtable.h
··· 228 228 #define VMALLOC_START (RGN_BASE(RGN_GATE) + 0x200000000UL) 229 229 #ifdef CONFIG_VIRTUAL_MEM_MAP 230 230 # define VMALLOC_END_INIT (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9))) 231 - # define VMALLOC_END vmalloc_end 232 - extern unsigned long vmalloc_end; 231 + extern unsigned long VMALLOC_END; 233 232 #else 234 233 #if defined(CONFIG_SPARSEMEM) && defined(CONFIG_SPARSEMEM_VMEMMAP) 235 234 /* SPARSEMEM_VMEMMAP uses half of vmalloc... */
+3 -3
arch/ia64/include/asm/processor.h
··· 229 229 #endif 230 230 }; 231 231 232 - DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info); 232 + DECLARE_PER_CPU(struct cpuinfo_ia64, ia64_cpu_info); 233 233 234 234 /* 235 235 * The "local" data variable. It refers to the per-CPU data of the currently executing ··· 237 237 * Do not use the address of local_cpu_data, since it will be different from 238 238 * cpu_data(smp_processor_id())! 239 239 */ 240 - #define local_cpu_data (&__ia64_per_cpu_var(cpu_info)) 241 - #define cpu_data(cpu) (&per_cpu(cpu_info, cpu)) 240 + #define local_cpu_data (&__ia64_per_cpu_var(ia64_cpu_info)) 241 + #define cpu_data(cpu) (&per_cpu(ia64_cpu_info, cpu)) 242 242 243 243 extern void print_cpu_info (struct cpuinfo_ia64 *); 244 244
+15 -18
arch/ia64/kernel/acpi.c
··· 702 702 printk(KERN_ERR PREFIX 703 703 "Error parsing MADT - no LAPIC entries\n"); 704 704 705 + #ifdef CONFIG_SMP 706 + if (available_cpus == 0) { 707 + printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); 708 + printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); 709 + smp_boot_data.cpu_phys_id[available_cpus] = 710 + hard_smp_processor_id(); 711 + available_cpus = 1; /* We've got at least one of these, no? */ 712 + } 713 + smp_boot_data.cpu_count = available_cpus; 714 + #endif 715 + /* Make boot-up look pretty */ 716 + printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, 717 + total_cpus); 718 + 705 719 return 0; 706 720 } 707 - 708 - 709 721 710 722 int __init acpi_boot_init(void) 711 723 { ··· 781 769 if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) 782 770 printk(KERN_ERR PREFIX "Can't find FADT\n"); 783 771 772 + #ifdef CONFIG_ACPI_NUMA 784 773 #ifdef CONFIG_SMP 785 - if (available_cpus == 0) { 786 - printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); 787 - printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); 788 - smp_boot_data.cpu_phys_id[available_cpus] = 789 - hard_smp_processor_id(); 790 - available_cpus = 1; /* We've got at least one of these, no? */ 791 - } 792 - smp_boot_data.cpu_count = available_cpus; 793 - 794 - smp_build_cpu_map(); 795 - # ifdef CONFIG_ACPI_NUMA 796 774 if (srat_num_cpus == 0) { 797 775 int cpu, i = 1; 798 776 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++) ··· 791 789 node_cpuid[i++].phys_id = 792 790 smp_boot_data.cpu_phys_id[cpu]; 793 791 } 794 - # endif 795 792 #endif 796 - #ifdef CONFIG_ACPI_NUMA 797 793 build_cpu_to_node_map(); 798 794 #endif 799 - /* Make boot-up look pretty */ 800 - printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, 801 - total_cpus); 802 795 return 0; 803 796 } 804 797
+2 -2
arch/ia64/kernel/head.S
··· 1051 1051 * intermediate precision so that we can produce a full 64-bit result. 1052 1052 */ 1053 1053 GLOBAL_ENTRY(ia64_native_sched_clock) 1054 - addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1054 + addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1055 1055 mov.m r9=ar.itc // fetch cycle-counter (35 cyc) 1056 1056 ;; 1057 1057 ldf8 f8=[r8] ··· 1077 1077 #ifdef CONFIG_VIRT_CPU_ACCOUNTING 1078 1078 GLOBAL_ENTRY(cycle_to_cputime) 1079 1079 alloc r16=ar.pfs,1,0,0,0 1080 - addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1080 + addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1081 1081 ;; 1082 1082 ldf8 f8=[r8] 1083 1083 ;;
+1 -1
arch/ia64/kernel/ia64_ksyms.c
··· 30 30 #endif 31 31 32 32 #include <asm/processor.h> 33 - EXPORT_SYMBOL(per_cpu__cpu_info); 33 + EXPORT_SYMBOL(per_cpu__ia64_cpu_info); 34 34 #ifdef CONFIG_SMP 35 35 EXPORT_SYMBOL(per_cpu__local_per_cpu_offset); 36 36 #endif
+1 -1
arch/ia64/kernel/mca_asm.S
··· 59 59 ia64_do_tlb_purge: 60 60 #define O(member) IA64_CPUINFO_##member##_OFFSET 61 61 62 - GET_THIS_PADDR(r2, cpu_info) // load phys addr of cpu_info into r2 62 + GET_THIS_PADDR(r2, ia64_cpu_info) // load phys addr of cpu_info into r2 63 63 ;; 64 64 addl r17=O(PTCE_STRIDE),r2 65 65 addl r2=O(PTCE_BASE),r2
+1 -1
arch/ia64/kernel/relocate_kernel.S
··· 61 61 62 62 // purge all TC entries 63 63 #define O(member) IA64_CPUINFO_##member##_OFFSET 64 - GET_THIS_PADDR(r2, cpu_info) // load phys addr of cpu_info into r2 64 + GET_THIS_PADDR(r2, ia64_cpu_info) // load phys addr of cpu_info into r2 65 65 ;; 66 66 addl r17=O(PTCE_STRIDE),r2 67 67 addl r2=O(PTCE_BASE),r2
+7 -20
arch/ia64/kernel/setup.c
··· 74 74 EXPORT_SYMBOL(__per_cpu_offset); 75 75 #endif 76 76 77 - DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 77 + DEFINE_PER_CPU(struct cpuinfo_ia64, ia64_cpu_info); 78 78 DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 79 79 unsigned long ia64_cycles_per_usec; 80 80 struct ia64_boot_param *ia64_boot_param; ··· 566 566 early_acpi_boot_init(); 567 567 # ifdef CONFIG_ACPI_NUMA 568 568 acpi_numa_init(); 569 - #ifdef CONFIG_ACPI_HOTPLUG_CPU 569 + # ifdef CONFIG_ACPI_HOTPLUG_CPU 570 570 prefill_possible_map(); 571 - #endif 571 + # endif 572 572 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ? 573 573 32 : cpus_weight(early_cpu_possible_map)), 574 574 additional_cpus > 0 ? additional_cpus : 0); 575 575 # endif 576 - #else 577 - # ifdef CONFIG_SMP 578 - smp_build_cpu_map(); /* happens, e.g., with the Ski simulator */ 579 - # endif 580 576 #endif /* CONFIG_APCI_BOOT */ 581 577 578 + #ifdef CONFIG_SMP 579 + smp_build_cpu_map(); 580 + #endif 582 581 find_memory(); 583 582 584 583 /* process SAL system table: */ ··· 855 856 } 856 857 857 858 /* 858 - * In UP configuration, setup_per_cpu_areas() is defined in 859 - * include/linux/percpu.h 860 - */ 861 - #ifdef CONFIG_SMP 862 - void __init 863 - setup_per_cpu_areas (void) 864 - { 865 - /* start_kernel() requires this... */ 866 - } 867 - #endif 868 - 869 - /* 870 859 * Do the following calculations: 871 860 * 872 861 * 1. the max. cache line size. ··· 967 980 * depends on the data returned by identify_cpu(). We break the dependency by 968 981 * accessing cpu_data() through the canonical per-CPU address. 969 982 */ 970 - cpu_info = cpu_data + ((char *) &__ia64_per_cpu_var(cpu_info) - __per_cpu_start); 983 + cpu_info = cpu_data + ((char *) &__ia64_per_cpu_var(ia64_cpu_info) - __per_cpu_start); 971 984 identify_cpu(cpu_info); 972 985 973 986 #ifdef CONFIG_MCKINLEY
+6 -5
arch/ia64/kernel/vmlinux.lds.S
··· 166 166 } 167 167 #endif 168 168 169 + #ifdef CONFIG_SMP 170 + . = ALIGN(PERCPU_PAGE_SIZE); 171 + __cpu0_per_cpu = .; 172 + . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ 173 + #endif 174 + 169 175 . = ALIGN(PAGE_SIZE); 170 176 __init_end = .; 171 177 ··· 204 198 data : { } :data 205 199 .data : AT(ADDR(.data) - LOAD_OFFSET) 206 200 { 207 - #ifdef CONFIG_SMP 208 - . = ALIGN(PERCPU_PAGE_SIZE); 209 - __cpu0_per_cpu = .; 210 - . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ 211 - #endif 212 201 INIT_TASK_DATA(PAGE_SIZE) 213 202 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES) 214 203 READ_MOSTLY_DATA(SMP_CACHE_BYTES)
+80 -19
arch/ia64/mm/contig.c
··· 154 154 void * __cpuinit 155 155 per_cpu_init (void) 156 156 { 157 - int cpu; 158 - static int first_time=1; 157 + static bool first_time = true; 158 + void *cpu0_data = __cpu0_per_cpu; 159 + unsigned int cpu; 160 + 161 + if (!first_time) 162 + goto skip; 163 + first_time = false; 159 164 160 165 /* 161 - * get_free_pages() cannot be used before cpu_init() done. BSP 162 - * allocates "NR_CPUS" pages for all CPUs to avoid that AP calls 163 - * get_zeroed_page(). 166 + * get_free_pages() cannot be used before cpu_init() done. 167 + * BSP allocates PERCPU_PAGE_SIZE bytes for all possible CPUs 168 + * to avoid that AP calls get_zeroed_page(). 164 169 */ 165 - if (first_time) { 166 - void *cpu0_data = __cpu0_per_cpu; 170 + for_each_possible_cpu(cpu) { 171 + void *src = cpu == 0 ? cpu0_data : __phys_per_cpu_start; 167 172 168 - first_time=0; 173 + memcpy(cpu_data, src, __per_cpu_end - __per_cpu_start); 174 + __per_cpu_offset[cpu] = (char *)cpu_data - __per_cpu_start; 175 + per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu]; 169 176 170 - __per_cpu_offset[0] = (char *) cpu0_data - __per_cpu_start; 171 - per_cpu(local_per_cpu_offset, 0) = __per_cpu_offset[0]; 177 + /* 178 + * percpu area for cpu0 is moved from the __init area 179 + * which is setup by head.S and used till this point. 180 + * Update ar.k3. This move is ensures that percpu 181 + * area for cpu0 is on the correct node and its 182 + * virtual address isn't insanely far from other 183 + * percpu areas which is important for congruent 184 + * percpu allocator. 185 + */ 186 + if (cpu == 0) 187 + ia64_set_kr(IA64_KR_PER_CPU_DATA, __pa(cpu_data) - 188 + (unsigned long)__per_cpu_start); 172 189 173 - for (cpu = 1; cpu < NR_CPUS; cpu++) { 174 - memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start); 175 - __per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start; 176 - cpu_data += PERCPU_PAGE_SIZE; 177 - per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu]; 178 - } 190 + cpu_data += PERCPU_PAGE_SIZE; 179 191 } 192 + skip: 180 193 return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; 181 194 } 182 195 183 196 static inline void 184 197 alloc_per_cpu_data(void) 185 198 { 186 - cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS-1, 199 + cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * num_possible_cpus(), 187 200 PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); 201 + } 202 + 203 + /** 204 + * setup_per_cpu_areas - setup percpu areas 205 + * 206 + * Arch code has already allocated and initialized percpu areas. All 207 + * this function has to do is to teach the determined layout to the 208 + * dynamic percpu allocator, which happens to be more complex than 209 + * creating whole new ones using helpers. 210 + */ 211 + void __init 212 + setup_per_cpu_areas(void) 213 + { 214 + struct pcpu_alloc_info *ai; 215 + struct pcpu_group_info *gi; 216 + unsigned int cpu; 217 + ssize_t static_size, reserved_size, dyn_size; 218 + int rc; 219 + 220 + ai = pcpu_alloc_alloc_info(1, num_possible_cpus()); 221 + if (!ai) 222 + panic("failed to allocate pcpu_alloc_info"); 223 + gi = &ai->groups[0]; 224 + 225 + /* units are assigned consecutively to possible cpus */ 226 + for_each_possible_cpu(cpu) 227 + gi->cpu_map[gi->nr_units++] = cpu; 228 + 229 + /* set parameters */ 230 + static_size = __per_cpu_end - __per_cpu_start; 231 + reserved_size = PERCPU_MODULE_RESERVE; 232 + dyn_size = PERCPU_PAGE_SIZE - static_size - reserved_size; 233 + if (dyn_size < 0) 234 + panic("percpu area overflow static=%zd reserved=%zd\n", 235 + static_size, reserved_size); 236 + 237 + ai->static_size = static_size; 238 + ai->reserved_size = reserved_size; 239 + ai->dyn_size = dyn_size; 240 + ai->unit_size = PERCPU_PAGE_SIZE; 241 + ai->atom_size = PAGE_SIZE; 242 + ai->alloc_size = PERCPU_PAGE_SIZE; 243 + 244 + rc = pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]); 245 + if (rc) 246 + panic("failed to setup percpu area (err=%d)", rc); 247 + 248 + pcpu_free_alloc_info(ai); 188 249 } 189 250 #else 190 251 #define alloc_per_cpu_data() do { } while (0) ··· 331 270 332 271 map_size = PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 333 272 sizeof(struct page)); 334 - vmalloc_end -= map_size; 335 - vmem_map = (struct page *) vmalloc_end; 273 + VMALLOC_END -= map_size; 274 + vmem_map = (struct page *) VMALLOC_END; 336 275 efi_memmap_walk(create_mem_map_page_table, NULL); 337 276 338 277 /*
+114 -15
arch/ia64/mm/discontig.c
··· 143 143 int cpu; 144 144 145 145 for_each_possible_early_cpu(cpu) { 146 - if (cpu == 0) { 147 - void *cpu0_data = __cpu0_per_cpu; 148 - __per_cpu_offset[cpu] = (char*)cpu0_data - 149 - __per_cpu_start; 150 - } else if (node == node_cpuid[cpu].nid) { 151 - memcpy(__va(cpu_data), __phys_per_cpu_start, 152 - __per_cpu_end - __per_cpu_start); 153 - __per_cpu_offset[cpu] = (char*)__va(cpu_data) - 154 - __per_cpu_start; 155 - cpu_data += PERCPU_PAGE_SIZE; 156 - } 146 + void *src = cpu == 0 ? __cpu0_per_cpu : __phys_per_cpu_start; 147 + 148 + if (node != node_cpuid[cpu].nid) 149 + continue; 150 + 151 + memcpy(__va(cpu_data), src, __per_cpu_end - __per_cpu_start); 152 + __per_cpu_offset[cpu] = (char *)__va(cpu_data) - 153 + __per_cpu_start; 154 + 155 + /* 156 + * percpu area for cpu0 is moved from the __init area 157 + * which is setup by head.S and used till this point. 158 + * Update ar.k3. This move is ensures that percpu 159 + * area for cpu0 is on the correct node and its 160 + * virtual address isn't insanely far from other 161 + * percpu areas which is important for congruent 162 + * percpu allocator. 163 + */ 164 + if (cpu == 0) 165 + ia64_set_kr(IA64_KR_PER_CPU_DATA, 166 + (unsigned long)cpu_data - 167 + (unsigned long)__per_cpu_start); 168 + 169 + cpu_data += PERCPU_PAGE_SIZE; 157 170 } 158 171 #endif 159 172 return cpu_data; 160 173 } 174 + 175 + #ifdef CONFIG_SMP 176 + /** 177 + * setup_per_cpu_areas - setup percpu areas 178 + * 179 + * Arch code has already allocated and initialized percpu areas. All 180 + * this function has to do is to teach the determined layout to the 181 + * dynamic percpu allocator, which happens to be more complex than 182 + * creating whole new ones using helpers. 183 + */ 184 + void __init setup_per_cpu_areas(void) 185 + { 186 + struct pcpu_alloc_info *ai; 187 + struct pcpu_group_info *uninitialized_var(gi); 188 + unsigned int *cpu_map; 189 + void *base; 190 + unsigned long base_offset; 191 + unsigned int cpu; 192 + ssize_t static_size, reserved_size, dyn_size; 193 + int node, prev_node, unit, nr_units, rc; 194 + 195 + ai = pcpu_alloc_alloc_info(MAX_NUMNODES, nr_cpu_ids); 196 + if (!ai) 197 + panic("failed to allocate pcpu_alloc_info"); 198 + cpu_map = ai->groups[0].cpu_map; 199 + 200 + /* determine base */ 201 + base = (void *)ULONG_MAX; 202 + for_each_possible_cpu(cpu) 203 + base = min(base, 204 + (void *)(__per_cpu_offset[cpu] + __per_cpu_start)); 205 + base_offset = (void *)__per_cpu_start - base; 206 + 207 + /* build cpu_map, units are grouped by node */ 208 + unit = 0; 209 + for_each_node(node) 210 + for_each_possible_cpu(cpu) 211 + if (node == node_cpuid[cpu].nid) 212 + cpu_map[unit++] = cpu; 213 + nr_units = unit; 214 + 215 + /* set basic parameters */ 216 + static_size = __per_cpu_end - __per_cpu_start; 217 + reserved_size = PERCPU_MODULE_RESERVE; 218 + dyn_size = PERCPU_PAGE_SIZE - static_size - reserved_size; 219 + if (dyn_size < 0) 220 + panic("percpu area overflow static=%zd reserved=%zd\n", 221 + static_size, reserved_size); 222 + 223 + ai->static_size = static_size; 224 + ai->reserved_size = reserved_size; 225 + ai->dyn_size = dyn_size; 226 + ai->unit_size = PERCPU_PAGE_SIZE; 227 + ai->atom_size = PAGE_SIZE; 228 + ai->alloc_size = PERCPU_PAGE_SIZE; 229 + 230 + /* 231 + * CPUs are put into groups according to node. Walk cpu_map 232 + * and create new groups at node boundaries. 233 + */ 234 + prev_node = -1; 235 + ai->nr_groups = 0; 236 + for (unit = 0; unit < nr_units; unit++) { 237 + cpu = cpu_map[unit]; 238 + node = node_cpuid[cpu].nid; 239 + 240 + if (node == prev_node) { 241 + gi->nr_units++; 242 + continue; 243 + } 244 + prev_node = node; 245 + 246 + gi = &ai->groups[ai->nr_groups++]; 247 + gi->nr_units = 1; 248 + gi->base_offset = __per_cpu_offset[cpu] + base_offset; 249 + gi->cpu_map = &cpu_map[unit]; 250 + } 251 + 252 + rc = pcpu_setup_first_chunk(ai, base); 253 + if (rc) 254 + panic("failed to setup percpu area (err=%d)", rc); 255 + 256 + pcpu_free_alloc_info(ai); 257 + } 258 + #endif 161 259 162 260 /** 163 261 * fill_pernode - initialize pernode data. ··· 450 352 /* Set the node_data pointer for each per-cpu struct */ 451 353 for_each_possible_early_cpu(cpu) { 452 354 node = node_cpuid[cpu].nid; 453 - per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data; 355 + per_cpu(ia64_cpu_info, cpu).node_data = 356 + mem_data[node].node_data; 454 357 } 455 358 #else 456 359 { ··· 459 360 cpu = 0; 460 361 node = node_cpuid[cpu].nid; 461 362 cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start + 462 - ((char *)&per_cpu__cpu_info - __per_cpu_start)); 363 + ((char *)&per_cpu__ia64_cpu_info - __per_cpu_start)); 463 364 cpu0_cpu_info->node_data = mem_data[node].node_data; 464 365 } 465 366 #endif /* CONFIG_SMP */ ··· 765 666 sparse_init(); 766 667 767 668 #ifdef CONFIG_VIRTUAL_MEM_MAP 768 - vmalloc_end -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 669 + VMALLOC_END -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 769 670 sizeof(struct page)); 770 - vmem_map = (struct page *) vmalloc_end; 671 + vmem_map = (struct page *) VMALLOC_END; 771 672 efi_memmap_walk(create_mem_map_page_table, NULL); 772 673 printk("Virtual mem_map starts at 0x%p\n", vmem_map); 773 674 #endif
+2 -2
arch/ia64/mm/init.c
··· 44 44 unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL; 45 45 46 46 #ifdef CONFIG_VIRTUAL_MEM_MAP 47 - unsigned long vmalloc_end = VMALLOC_END_INIT; 48 - EXPORT_SYMBOL(vmalloc_end); 47 + unsigned long VMALLOC_END = VMALLOC_END_INIT; 48 + EXPORT_SYMBOL(VMALLOC_END); 49 49 struct page *vmem_map; 50 50 EXPORT_SYMBOL(vmem_map); 51 51 #endif
+4 -4
arch/ia64/sn/kernel/sn2/sn2_smp.c
··· 496 496 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, 497 497 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, 498 498 stat->deadlocks, 499 - 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 500 - 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 501 - 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec, 499 + 1000 * stat->lock_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec, 500 + 1000 * stat->shub_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec, 501 + 1000 * stat->shub_itc_clocks_max / per_cpu(ia64_cpu_info, cpu).cyc_per_usec, 502 502 stat->shub_ptc_flushes_not_my_mm, 503 503 stat->deadlocks2, 504 504 stat->shub_ipi_flushes, 505 - 1000 * stat->shub_ipi_flushes_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec); 505 + 1000 * stat->shub_ipi_flushes_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec); 506 506 } 507 507 return 0; 508 508 }
+67 -64
arch/ia64/xen/irq_xen.c
··· 63 63 } 64 64 65 65 66 - static DEFINE_PER_CPU(int, timer_irq) = -1; 67 - static DEFINE_PER_CPU(int, ipi_irq) = -1; 68 - static DEFINE_PER_CPU(int, resched_irq) = -1; 69 - static DEFINE_PER_CPU(int, cmc_irq) = -1; 70 - static DEFINE_PER_CPU(int, cmcp_irq) = -1; 71 - static DEFINE_PER_CPU(int, cpep_irq) = -1; 66 + static DEFINE_PER_CPU(int, xen_timer_irq) = -1; 67 + static DEFINE_PER_CPU(int, xen_ipi_irq) = -1; 68 + static DEFINE_PER_CPU(int, xen_resched_irq) = -1; 69 + static DEFINE_PER_CPU(int, xen_cmc_irq) = -1; 70 + static DEFINE_PER_CPU(int, xen_cmcp_irq) = -1; 71 + static DEFINE_PER_CPU(int, xen_cpep_irq) = -1; 72 72 #define NAME_SIZE 15 73 - static DEFINE_PER_CPU(char[NAME_SIZE], timer_name); 74 - static DEFINE_PER_CPU(char[NAME_SIZE], ipi_name); 75 - static DEFINE_PER_CPU(char[NAME_SIZE], resched_name); 76 - static DEFINE_PER_CPU(char[NAME_SIZE], cmc_name); 77 - static DEFINE_PER_CPU(char[NAME_SIZE], cmcp_name); 78 - static DEFINE_PER_CPU(char[NAME_SIZE], cpep_name); 73 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_timer_name); 74 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_ipi_name); 75 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_resched_name); 76 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmc_name); 77 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmcp_name); 78 + static DEFINE_PER_CPU(char[NAME_SIZE], xen_cpep_name); 79 79 #undef NAME_SIZE 80 80 81 81 struct saved_irq { ··· 144 144 if (xen_slab_ready) { 145 145 switch (vec) { 146 146 case IA64_TIMER_VECTOR: 147 - snprintf(per_cpu(timer_name, cpu), 148 - sizeof(per_cpu(timer_name, cpu)), 147 + snprintf(per_cpu(xen_timer_name, cpu), 148 + sizeof(per_cpu(xen_timer_name, cpu)), 149 149 "%s%d", action->name, cpu); 150 150 irq = bind_virq_to_irqhandler(VIRQ_ITC, cpu, 151 151 action->handler, action->flags, 152 - per_cpu(timer_name, cpu), action->dev_id); 153 - per_cpu(timer_irq, cpu) = irq; 152 + per_cpu(xen_timer_name, cpu), action->dev_id); 153 + per_cpu(xen_timer_irq, cpu) = irq; 154 154 break; 155 155 case IA64_IPI_RESCHEDULE: 156 - snprintf(per_cpu(resched_name, cpu), 157 - sizeof(per_cpu(resched_name, cpu)), 156 + snprintf(per_cpu(xen_resched_name, cpu), 157 + sizeof(per_cpu(xen_resched_name, cpu)), 158 158 "%s%d", action->name, cpu); 159 159 irq = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu, 160 160 action->handler, action->flags, 161 - per_cpu(resched_name, cpu), action->dev_id); 162 - per_cpu(resched_irq, cpu) = irq; 161 + per_cpu(xen_resched_name, cpu), action->dev_id); 162 + per_cpu(xen_resched_irq, cpu) = irq; 163 163 break; 164 164 case IA64_IPI_VECTOR: 165 - snprintf(per_cpu(ipi_name, cpu), 166 - sizeof(per_cpu(ipi_name, cpu)), 165 + snprintf(per_cpu(xen_ipi_name, cpu), 166 + sizeof(per_cpu(xen_ipi_name, cpu)), 167 167 "%s%d", action->name, cpu); 168 168 irq = bind_ipi_to_irqhandler(XEN_IPI_VECTOR, cpu, 169 169 action->handler, action->flags, 170 - per_cpu(ipi_name, cpu), action->dev_id); 171 - per_cpu(ipi_irq, cpu) = irq; 170 + per_cpu(xen_ipi_name, cpu), action->dev_id); 171 + per_cpu(xen_ipi_irq, cpu) = irq; 172 172 break; 173 173 case IA64_CMC_VECTOR: 174 - snprintf(per_cpu(cmc_name, cpu), 175 - sizeof(per_cpu(cmc_name, cpu)), 174 + snprintf(per_cpu(xen_cmc_name, cpu), 175 + sizeof(per_cpu(xen_cmc_name, cpu)), 176 176 "%s%d", action->name, cpu); 177 177 irq = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu, 178 - action->handler, 179 - action->flags, 180 - per_cpu(cmc_name, cpu), 181 - action->dev_id); 182 - per_cpu(cmc_irq, cpu) = irq; 178 + action->handler, 179 + action->flags, 180 + per_cpu(xen_cmc_name, cpu), 181 + action->dev_id); 182 + per_cpu(xen_cmc_irq, cpu) = irq; 183 183 break; 184 184 case IA64_CMCP_VECTOR: 185 - snprintf(per_cpu(cmcp_name, cpu), 186 - sizeof(per_cpu(cmcp_name, cpu)), 185 + snprintf(per_cpu(xen_cmcp_name, cpu), 186 + sizeof(per_cpu(xen_cmcp_name, cpu)), 187 187 "%s%d", action->name, cpu); 188 188 irq = bind_ipi_to_irqhandler(XEN_CMCP_VECTOR, cpu, 189 - action->handler, 190 - action->flags, 191 - per_cpu(cmcp_name, cpu), 192 - action->dev_id); 193 - per_cpu(cmcp_irq, cpu) = irq; 189 + action->handler, 190 + action->flags, 191 + per_cpu(xen_cmcp_name, cpu), 192 + action->dev_id); 193 + per_cpu(xen_cmcp_irq, cpu) = irq; 194 194 break; 195 195 case IA64_CPEP_VECTOR: 196 - snprintf(per_cpu(cpep_name, cpu), 197 - sizeof(per_cpu(cpep_name, cpu)), 196 + snprintf(per_cpu(xen_cpep_name, cpu), 197 + sizeof(per_cpu(xen_cpep_name, cpu)), 198 198 "%s%d", action->name, cpu); 199 199 irq = bind_ipi_to_irqhandler(XEN_CPEP_VECTOR, cpu, 200 - action->handler, 201 - action->flags, 202 - per_cpu(cpep_name, cpu), 203 - action->dev_id); 204 - per_cpu(cpep_irq, cpu) = irq; 200 + action->handler, 201 + action->flags, 202 + per_cpu(xen_cpep_name, cpu), 203 + action->dev_id); 204 + per_cpu(xen_cpep_irq, cpu) = irq; 205 205 break; 206 206 case IA64_CPE_VECTOR: 207 207 case IA64_MCA_RENDEZ_VECTOR: ··· 275 275 276 276 if (action == CPU_DEAD) { 277 277 /* Unregister evtchn. */ 278 - if (per_cpu(cpep_irq, cpu) >= 0) { 279 - unbind_from_irqhandler(per_cpu(cpep_irq, cpu), NULL); 280 - per_cpu(cpep_irq, cpu) = -1; 278 + if (per_cpu(xen_cpep_irq, cpu) >= 0) { 279 + unbind_from_irqhandler(per_cpu(xen_cpep_irq, cpu), 280 + NULL); 281 + per_cpu(xen_cpep_irq, cpu) = -1; 281 282 } 282 - if (per_cpu(cmcp_irq, cpu) >= 0) { 283 - unbind_from_irqhandler(per_cpu(cmcp_irq, cpu), NULL); 284 - per_cpu(cmcp_irq, cpu) = -1; 283 + if (per_cpu(xen_cmcp_irq, cpu) >= 0) { 284 + unbind_from_irqhandler(per_cpu(xen_cmcp_irq, cpu), 285 + NULL); 286 + per_cpu(xen_cmcp_irq, cpu) = -1; 285 287 } 286 - if (per_cpu(cmc_irq, cpu) >= 0) { 287 - unbind_from_irqhandler(per_cpu(cmc_irq, cpu), NULL); 288 - per_cpu(cmc_irq, cpu) = -1; 288 + if (per_cpu(xen_cmc_irq, cpu) >= 0) { 289 + unbind_from_irqhandler(per_cpu(xen_cmc_irq, cpu), NULL); 290 + per_cpu(xen_cmc_irq, cpu) = -1; 289 291 } 290 - if (per_cpu(ipi_irq, cpu) >= 0) { 291 - unbind_from_irqhandler(per_cpu(ipi_irq, cpu), NULL); 292 - per_cpu(ipi_irq, cpu) = -1; 292 + if (per_cpu(xen_ipi_irq, cpu) >= 0) { 293 + unbind_from_irqhandler(per_cpu(xen_ipi_irq, cpu), NULL); 294 + per_cpu(xen_ipi_irq, cpu) = -1; 293 295 } 294 - if (per_cpu(resched_irq, cpu) >= 0) { 295 - unbind_from_irqhandler(per_cpu(resched_irq, cpu), 296 - NULL); 297 - per_cpu(resched_irq, cpu) = -1; 296 + if (per_cpu(xen_resched_irq, cpu) >= 0) { 297 + unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), 298 + NULL); 299 + per_cpu(xen_resched_irq, cpu) = -1; 298 300 } 299 - if (per_cpu(timer_irq, cpu) >= 0) { 300 - unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL); 301 - per_cpu(timer_irq, cpu) = -1; 301 + if (per_cpu(xen_timer_irq, cpu) >= 0) { 302 + unbind_from_irqhandler(per_cpu(xen_timer_irq, cpu), 303 + NULL); 304 + per_cpu(xen_timer_irq, cpu) = -1; 302 305 } 303 306 } 304 307 return NOTIFY_OK;
+11 -11
arch/ia64/xen/time.c
··· 34 34 35 35 #include "../kernel/fsyscall_gtod_data.h" 36 36 37 - DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); 38 - DEFINE_PER_CPU(unsigned long, processed_stolen_time); 39 - DEFINE_PER_CPU(unsigned long, processed_blocked_time); 37 + static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate); 38 + static DEFINE_PER_CPU(unsigned long, xen_stolen_time); 39 + static DEFINE_PER_CPU(unsigned long, xen_blocked_time); 40 40 41 41 /* taken from i386/kernel/time-xen.c */ 42 42 static void xen_init_missing_ticks_accounting(int cpu) 43 43 { 44 44 struct vcpu_register_runstate_memory_area area; 45 - struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu); 45 + struct vcpu_runstate_info *runstate = &per_cpu(xen_runstate, cpu); 46 46 int rc; 47 47 48 48 memset(runstate, 0, sizeof(*runstate)); ··· 52 52 &area); 53 53 WARN_ON(rc && rc != -ENOSYS); 54 54 55 - per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked]; 56 - per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable] 55 + per_cpu(xen_blocked_time, cpu) = runstate->time[RUNSTATE_blocked]; 56 + per_cpu(xen_stolen_time, cpu) = runstate->time[RUNSTATE_runnable] 57 57 + runstate->time[RUNSTATE_offline]; 58 58 } 59 59 ··· 68 68 69 69 BUG_ON(preemptible()); 70 70 71 - state = &__get_cpu_var(runstate); 71 + state = &__get_cpu_var(xen_runstate); 72 72 73 73 /* 74 74 * The runstate info is always updated by the hypervisor on ··· 103 103 * This function just checks and reject this effect. 104 104 */ 105 105 if (!time_after_eq(runstate.time[RUNSTATE_blocked], 106 - per_cpu(processed_blocked_time, cpu))) 106 + per_cpu(xen_blocked_time, cpu))) 107 107 blocked = 0; 108 108 109 109 if (!time_after_eq(runstate.time[RUNSTATE_runnable] + 110 110 runstate.time[RUNSTATE_offline], 111 - per_cpu(processed_stolen_time, cpu))) 111 + per_cpu(xen_stolen_time, cpu))) 112 112 stolen = 0; 113 113 114 114 if (!time_after(delta_itm + new_itm, ia64_get_itc())) ··· 147 147 } else { 148 148 local_cpu_data->itm_next = delta_itm + new_itm; 149 149 } 150 - per_cpu(processed_stolen_time, cpu) += NS_PER_TICK * stolen; 151 - per_cpu(processed_blocked_time, cpu) += NS_PER_TICK * blocked; 150 + per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen; 151 + per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked; 152 152 } 153 153 return delta_itm; 154 154 }
+2 -2
arch/m68k/include/asm/pgtable_mm.h
··· 83 83 #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) 84 84 #define VMALLOC_END KMAP_START 85 85 #else 86 - extern unsigned long vmalloc_end; 86 + extern unsigned long m68k_vmalloc_end; 87 87 #define VMALLOC_START 0x0f800000 88 - #define VMALLOC_END vmalloc_end 88 + #define VMALLOC_END m68k_vmalloc_end 89 89 #endif /* CONFIG_SUN3 */ 90 90 91 91 /* zero page used for uninitialized stuff */
+4 -4
arch/m68k/sun3/mmu_emu.c
··· 45 45 ** Globals 46 46 */ 47 47 48 - unsigned long vmalloc_end; 49 - EXPORT_SYMBOL(vmalloc_end); 48 + unsigned long m68k_vmalloc_end; 49 + EXPORT_SYMBOL(m68k_vmalloc_end); 50 50 51 51 unsigned long pmeg_vaddr[PMEGS_NUM]; 52 52 unsigned char pmeg_alloc[PMEGS_NUM]; ··· 172 172 #endif 173 173 // the lowest mapping here is the end of our 174 174 // vmalloc region 175 - if(!vmalloc_end) 176 - vmalloc_end = seg; 175 + if (!m68k_vmalloc_end) 176 + m68k_vmalloc_end = seg; 177 177 178 178 // mark the segmap alloc'd, and reserve any 179 179 // of the first 0xbff pages the hardware is
+30 -31
arch/mn10300/kernel/kprobes.c
··· 31 31 #define KPROBE_HIT_ACTIVE 0x00000001 32 32 #define KPROBE_HIT_SS 0x00000002 33 33 34 - static struct kprobe *current_kprobe; 35 - static unsigned long current_kprobe_orig_pc; 36 - static unsigned long current_kprobe_next_pc; 37 - static int current_kprobe_ss_flags; 34 + static struct kprobe *cur_kprobe; 35 + static unsigned long cur_kprobe_orig_pc; 36 + static unsigned long cur_kprobe_next_pc; 37 + static int cur_kprobe_ss_flags; 38 38 static unsigned long kprobe_status; 39 - static kprobe_opcode_t current_kprobe_ss_buf[MAX_INSN_SIZE + 2]; 40 - static unsigned long current_kprobe_bp_addr; 39 + static kprobe_opcode_t cur_kprobe_ss_buf[MAX_INSN_SIZE + 2]; 40 + static unsigned long cur_kprobe_bp_addr; 41 41 42 42 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 43 43 ··· 399 399 { 400 400 unsigned long nextpc; 401 401 402 - current_kprobe_orig_pc = regs->pc; 403 - memcpy(current_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); 404 - regs->pc = (unsigned long) current_kprobe_ss_buf; 402 + cur_kprobe_orig_pc = regs->pc; 403 + memcpy(cur_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); 404 + regs->pc = (unsigned long) cur_kprobe_ss_buf; 405 405 406 - nextpc = find_nextpc(regs, &current_kprobe_ss_flags); 407 - if (current_kprobe_ss_flags & SINGLESTEP_PCREL) 408 - current_kprobe_next_pc = 409 - current_kprobe_orig_pc + (nextpc - regs->pc); 406 + nextpc = find_nextpc(regs, &cur_kprobe_ss_flags); 407 + if (cur_kprobe_ss_flags & SINGLESTEP_PCREL) 408 + cur_kprobe_next_pc = cur_kprobe_orig_pc + (nextpc - regs->pc); 410 409 else 411 - current_kprobe_next_pc = nextpc; 410 + cur_kprobe_next_pc = nextpc; 412 411 413 412 /* branching instructions need special handling */ 414 - if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) 413 + if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) 415 414 nextpc = singlestep_branch_setup(regs); 416 415 417 - current_kprobe_bp_addr = nextpc; 416 + cur_kprobe_bp_addr = nextpc; 418 417 419 418 *(u8 *) nextpc = BREAKPOINT_INSTRUCTION; 420 - mn10300_dcache_flush_range2((unsigned) current_kprobe_ss_buf, 421 - sizeof(current_kprobe_ss_buf)); 419 + mn10300_dcache_flush_range2((unsigned) cur_kprobe_ss_buf, 420 + sizeof(cur_kprobe_ss_buf)); 422 421 mn10300_icache_inv(); 423 422 } 424 423 ··· 439 440 disarm_kprobe(p, regs); 440 441 ret = 1; 441 442 } else { 442 - p = current_kprobe; 443 + p = cur_kprobe; 443 444 if (p->break_handler && p->break_handler(p, regs)) 444 445 goto ss_probe; 445 446 } ··· 463 464 } 464 465 465 466 kprobe_status = KPROBE_HIT_ACTIVE; 466 - current_kprobe = p; 467 + cur_kprobe = p; 467 468 if (p->pre_handler(p, regs)) { 468 469 /* handler has already set things up, so skip ss setup */ 469 470 return 1; ··· 490 491 static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) 491 492 { 492 493 /* we may need to fixup regs/stack after singlestepping a call insn */ 493 - if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) { 494 - regs->pc = current_kprobe_orig_pc; 494 + if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) { 495 + regs->pc = cur_kprobe_orig_pc; 495 496 switch (p->ainsn.insn[0]) { 496 497 case 0xcd: /* CALL (d16,PC) */ 497 498 *(unsigned *) regs->sp = regs->mdr = regs->pc + 5; ··· 522 523 } 523 524 } 524 525 525 - regs->pc = current_kprobe_next_pc; 526 - current_kprobe_bp_addr = 0; 526 + regs->pc = cur_kprobe_next_pc; 527 + cur_kprobe_bp_addr = 0; 527 528 } 528 529 529 530 static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) ··· 531 532 if (!kprobe_running()) 532 533 return 0; 533 534 534 - if (current_kprobe->post_handler) 535 - current_kprobe->post_handler(current_kprobe, regs, 0); 535 + if (cur_kprobe->post_handler) 536 + cur_kprobe->post_handler(cur_kprobe, regs, 0); 536 537 537 - resume_execution(current_kprobe, regs); 538 + resume_execution(cur_kprobe, regs); 538 539 reset_current_kprobe(); 539 540 preempt_enable_no_resched(); 540 541 return 1; ··· 544 545 static inline 545 546 int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 546 547 { 547 - if (current_kprobe->fault_handler && 548 - current_kprobe->fault_handler(current_kprobe, regs, trapnr)) 548 + if (cur_kprobe->fault_handler && 549 + cur_kprobe->fault_handler(cur_kprobe, regs, trapnr)) 549 550 return 1; 550 551 551 552 if (kprobe_status & KPROBE_HIT_SS) { 552 - resume_execution(current_kprobe, regs); 553 + resume_execution(cur_kprobe, regs); 553 554 reset_current_kprobe(); 554 555 preempt_enable_no_resched(); 555 556 } ··· 566 567 567 568 switch (val) { 568 569 case DIE_BREAKPOINT: 569 - if (current_kprobe_bp_addr != args->regs->pc) { 570 + if (cur_kprobe_bp_addr != args->regs->pc) { 570 571 if (kprobe_handler(args->regs)) 571 572 return NOTIFY_STOP; 572 573 } else {
+1 -1
arch/powerpc/include/asm/smp.h
··· 37 37 extern void smp_send_debugger_break(int cpu); 38 38 extern void smp_message_recv(int); 39 39 40 - DECLARE_PER_CPU(unsigned int, pvr); 40 + DECLARE_PER_CPU(unsigned int, cpu_pvr); 41 41 42 42 #ifdef CONFIG_HOTPLUG_CPU 43 43 extern void fixup_irqs(cpumask_t map);
+2 -2
arch/powerpc/kernel/perf_callchain.c
··· 487 487 * Since we can't get PMU interrupts inside a PMU interrupt handler, 488 488 * we don't need separate irq and nmi entries here. 489 489 */ 490 - static DEFINE_PER_CPU(struct perf_callchain_entry, callchain); 490 + static DEFINE_PER_CPU(struct perf_callchain_entry, cpu_perf_callchain); 491 491 492 492 struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) 493 493 { 494 - struct perf_callchain_entry *entry = &__get_cpu_var(callchain); 494 + struct perf_callchain_entry *entry = &__get_cpu_var(cpu_perf_callchain); 495 495 496 496 entry->nr = 0; 497 497
+2 -2
arch/powerpc/kernel/setup-common.c
··· 157 157 #endif /* CONFIG_TAU */ 158 158 159 159 #ifdef CONFIG_SMP 160 - DEFINE_PER_CPU(unsigned int, pvr); 160 + DEFINE_PER_CPU(unsigned int, cpu_pvr); 161 161 #endif 162 162 163 163 static int show_cpuinfo(struct seq_file *m, void *v) ··· 209 209 } 210 210 211 211 #ifdef CONFIG_SMP 212 - pvr = per_cpu(pvr, cpu_id); 212 + pvr = per_cpu(cpu_pvr, cpu_id); 213 213 #else 214 214 pvr = mfspr(SPRN_PVR); 215 215 #endif
+1 -1
arch/powerpc/kernel/smp.c
··· 235 235 236 236 static void __devinit smp_store_cpu_info(int id) 237 237 { 238 - per_cpu(pvr, id) = mfspr(SPRN_PVR); 238 + per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR); 239 239 } 240 240 241 241 static void __init smp_create_idle(unsigned int cpu)
+7 -7
arch/powerpc/platforms/cell/interrupt.c
··· 54 54 struct device_node *node; 55 55 }; 56 56 57 - static DEFINE_PER_CPU(struct iic, iic); 57 + static DEFINE_PER_CPU(struct iic, cpu_iic); 58 58 #define IIC_NODE_COUNT 2 59 59 static struct irq_host *iic_host; 60 60 ··· 82 82 83 83 static void iic_eoi(unsigned int irq) 84 84 { 85 - struct iic *iic = &__get_cpu_var(iic); 85 + struct iic *iic = &__get_cpu_var(cpu_iic); 86 86 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]); 87 87 BUG_ON(iic->eoi_ptr < 0); 88 88 } ··· 146 146 struct iic *iic; 147 147 unsigned int virq; 148 148 149 - iic = &__get_cpu_var(iic); 149 + iic = &__get_cpu_var(cpu_iic); 150 150 *(unsigned long *) &pending = 151 151 in_be64((u64 __iomem *) &iic->regs->pending_destr); 152 152 if (!(pending.flags & CBE_IIC_IRQ_VALID)) ··· 161 161 162 162 void iic_setup_cpu(void) 163 163 { 164 - out_be64(&__get_cpu_var(iic).regs->prio, 0xff); 164 + out_be64(&__get_cpu_var(cpu_iic).regs->prio, 0xff); 165 165 } 166 166 167 167 u8 iic_get_target_id(int cpu) 168 168 { 169 - return per_cpu(iic, cpu).target_id; 169 + return per_cpu(cpu_iic, cpu).target_id; 170 170 } 171 171 172 172 EXPORT_SYMBOL_GPL(iic_get_target_id); ··· 181 181 182 182 void iic_cause_IPI(int cpu, int mesg) 183 183 { 184 - out_be64(&per_cpu(iic, cpu).regs->generate, (0xf - mesg) << 4); 184 + out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - mesg) << 4); 185 185 } 186 186 187 187 struct irq_host *iic_get_irq_host(int node) ··· 348 348 /* XXX FIXME: should locate the linux CPU number from the HW cpu 349 349 * number properly. We are lucky for now 350 350 */ 351 - struct iic *iic = &per_cpu(iic, hw_cpu); 351 + struct iic *iic = &per_cpu(cpu_iic, hw_cpu); 352 352 353 353 iic->regs = ioremap(addr, sizeof(struct cbe_iic_thread_regs)); 354 354 BUG_ON(iic->regs == NULL);
+2 -2
arch/powerpc/platforms/pseries/dtl.c
··· 54 54 int buf_entries; 55 55 u64 last_idx; 56 56 }; 57 - static DEFINE_PER_CPU(struct dtl, dtl); 57 + static DEFINE_PER_CPU(struct dtl, cpu_dtl); 58 58 59 59 /* 60 60 * Dispatch trace log event mask: ··· 261 261 262 262 /* set up the per-cpu log structures */ 263 263 for_each_possible_cpu(i) { 264 - struct dtl *dtl = &per_cpu(dtl, i); 264 + struct dtl *dtl = &per_cpu(cpu_dtl, i); 265 265 dtl->cpu = i; 266 266 267 267 rc = dtl_setup_file(dtl);
+4 -4
arch/sparc/kernel/nmi.c
··· 47 47 static int endflag __initdata; 48 48 49 49 static DEFINE_PER_CPU(unsigned int, last_irq_sum); 50 - static DEFINE_PER_CPU(local_t, alert_counter); 50 + static DEFINE_PER_CPU(long, alert_counter); 51 51 static DEFINE_PER_CPU(int, nmi_touch); 52 52 53 53 void touch_nmi_watchdog(void) ··· 112 112 touched = 1; 113 113 } 114 114 if (!touched && __get_cpu_var(last_irq_sum) == sum) { 115 - local_inc(&__get_cpu_var(alert_counter)); 116 - if (local_read(&__get_cpu_var(alert_counter)) == 30 * nmi_hz) 115 + __this_cpu_inc(per_cpu_var(alert_counter)); 116 + if (__this_cpu_read(per_cpu_var(alert_counter)) == 30 * nmi_hz) 117 117 die_nmi("BUG: NMI Watchdog detected LOCKUP", 118 118 regs, panic_on_timeout); 119 119 } else { 120 120 __get_cpu_var(last_irq_sum) = sum; 121 - local_set(&__get_cpu_var(alert_counter), 0); 121 + __this_cpu_write(per_cpu_var(alert_counter), 0); 122 122 } 123 123 if (__get_cpu_var(wd_enabled)) { 124 124 write_pic(picl_value(nmi_hz));
+91 -13
arch/x86/include/asm/percpu.h
··· 74 74 75 75 #define percpu_to_op(op, var, val) \ 76 76 do { \ 77 - typedef typeof(var) T__; \ 77 + typedef typeof(var) pto_T__; \ 78 78 if (0) { \ 79 - T__ tmp__; \ 80 - tmp__ = (val); \ 79 + pto_T__ pto_tmp__; \ 80 + pto_tmp__ = (val); \ 81 81 } \ 82 82 switch (sizeof(var)) { \ 83 83 case 1: \ 84 84 asm(op "b %1,"__percpu_arg(0) \ 85 85 : "+m" (var) \ 86 - : "qi" ((T__)(val))); \ 86 + : "qi" ((pto_T__)(val))); \ 87 87 break; \ 88 88 case 2: \ 89 89 asm(op "w %1,"__percpu_arg(0) \ 90 90 : "+m" (var) \ 91 - : "ri" ((T__)(val))); \ 91 + : "ri" ((pto_T__)(val))); \ 92 92 break; \ 93 93 case 4: \ 94 94 asm(op "l %1,"__percpu_arg(0) \ 95 95 : "+m" (var) \ 96 - : "ri" ((T__)(val))); \ 96 + : "ri" ((pto_T__)(val))); \ 97 97 break; \ 98 98 case 8: \ 99 99 asm(op "q %1,"__percpu_arg(0) \ 100 100 : "+m" (var) \ 101 - : "re" ((T__)(val))); \ 101 + : "re" ((pto_T__)(val))); \ 102 102 break; \ 103 103 default: __bad_percpu_size(); \ 104 104 } \ ··· 106 106 107 107 #define percpu_from_op(op, var, constraint) \ 108 108 ({ \ 109 - typeof(var) ret__; \ 109 + typeof(var) pfo_ret__; \ 110 110 switch (sizeof(var)) { \ 111 111 case 1: \ 112 112 asm(op "b "__percpu_arg(1)",%0" \ 113 - : "=q" (ret__) \ 113 + : "=q" (pfo_ret__) \ 114 114 : constraint); \ 115 115 break; \ 116 116 case 2: \ 117 117 asm(op "w "__percpu_arg(1)",%0" \ 118 - : "=r" (ret__) \ 118 + : "=r" (pfo_ret__) \ 119 119 : constraint); \ 120 120 break; \ 121 121 case 4: \ 122 122 asm(op "l "__percpu_arg(1)",%0" \ 123 - : "=r" (ret__) \ 123 + : "=r" (pfo_ret__) \ 124 124 : constraint); \ 125 125 break; \ 126 126 case 8: \ 127 127 asm(op "q "__percpu_arg(1)",%0" \ 128 - : "=r" (ret__) \ 128 + : "=r" (pfo_ret__) \ 129 129 : constraint); \ 130 130 break; \ 131 131 default: __bad_percpu_size(); \ 132 132 } \ 133 - ret__; \ 133 + pfo_ret__; \ 134 134 }) 135 135 136 136 /* ··· 152 152 #define percpu_and(var, val) percpu_to_op("and", per_cpu__##var, val) 153 153 #define percpu_or(var, val) percpu_to_op("or", per_cpu__##var, val) 154 154 #define percpu_xor(var, val) percpu_to_op("xor", per_cpu__##var, val) 155 + 156 + #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 157 + #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 158 + #define __this_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 159 + 160 + #define __this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) 161 + #define __this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) 162 + #define __this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val) 163 + #define __this_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val) 164 + #define __this_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val) 165 + #define __this_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val) 166 + #define __this_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val) 167 + #define __this_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val) 168 + #define __this_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val) 169 + #define __this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) 170 + #define __this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) 171 + #define __this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) 172 + #define __this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val) 173 + #define __this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val) 174 + #define __this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val) 175 + 176 + #define this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 177 + #define this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 178 + #define this_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 179 + #define this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) 180 + #define this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) 181 + #define this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val) 182 + #define this_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val) 183 + #define this_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val) 184 + #define this_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val) 185 + #define this_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val) 186 + #define this_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val) 187 + #define this_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val) 188 + #define this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) 189 + #define this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) 190 + #define this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) 191 + #define this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val) 192 + #define this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val) 193 + #define this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val) 194 + 195 + #define irqsafe_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val) 196 + #define irqsafe_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val) 197 + #define irqsafe_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val) 198 + #define irqsafe_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val) 199 + #define irqsafe_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val) 200 + #define irqsafe_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val) 201 + #define irqsafe_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) 202 + #define irqsafe_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) 203 + #define irqsafe_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) 204 + #define irqsafe_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val) 205 + #define irqsafe_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val) 206 + #define irqsafe_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val) 207 + 208 + /* 209 + * Per cpu atomic 64 bit operations are only available under 64 bit. 210 + * 32 bit must fall back to generic operations. 211 + */ 212 + #ifdef CONFIG_X86_64 213 + #define __this_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 214 + #define __this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) 215 + #define __this_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val) 216 + #define __this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 217 + #define __this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 218 + #define __this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val) 219 + 220 + #define this_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 221 + #define this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) 222 + #define this_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val) 223 + #define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 224 + #define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 225 + #define this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val) 226 + 227 + #define irqsafe_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val) 228 + #define irqsafe_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 229 + #define irqsafe_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 230 + #define irqsafe_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val) 231 + 232 + #endif 155 233 156 234 /* This is not atomic against other CPUs -- CPU preemption needs to be off */ 157 235 #define x86_test_and_clear_bit_percpu(bit, var) \
+4 -4
arch/x86/kernel/apic/nmi.c
··· 361 361 */ 362 362 363 363 static DEFINE_PER_CPU(unsigned, last_irq_sum); 364 - static DEFINE_PER_CPU(local_t, alert_counter); 364 + static DEFINE_PER_CPU(long, alert_counter); 365 365 static DEFINE_PER_CPU(int, nmi_touch); 366 366 367 367 void touch_nmi_watchdog(void) ··· 438 438 * Ayiee, looks like this CPU is stuck ... 439 439 * wait a few IRQs (5 seconds) before doing the oops ... 440 440 */ 441 - local_inc(&__get_cpu_var(alert_counter)); 442 - if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz) 441 + __this_cpu_inc(per_cpu_var(alert_counter)); 442 + if (__this_cpu_read(per_cpu_var(alert_counter)) == 5 * nmi_hz) 443 443 /* 444 444 * die_nmi will return ONLY if NOTIFY_STOP happens.. 445 445 */ ··· 447 447 regs, panic_on_timeout); 448 448 } else { 449 449 __get_cpu_var(last_irq_sum) = sum; 450 - local_set(&__get_cpu_var(alert_counter), 0); 450 + __this_cpu_write(per_cpu_var(alert_counter), 0); 451 451 } 452 452 453 453 /* see if the nmi watchdog went off */
+4 -4
arch/x86/kernel/cpu/common.c
··· 1093 1093 1094 1094 void __cpuinit cpu_init(void) 1095 1095 { 1096 - struct orig_ist *orig_ist; 1096 + struct orig_ist *oist; 1097 1097 struct task_struct *me; 1098 1098 struct tss_struct *t; 1099 1099 unsigned long v; ··· 1102 1102 1103 1103 cpu = stack_smp_processor_id(); 1104 1104 t = &per_cpu(init_tss, cpu); 1105 - orig_ist = &per_cpu(orig_ist, cpu); 1105 + oist = &per_cpu(orig_ist, cpu); 1106 1106 1107 1107 #ifdef CONFIG_NUMA 1108 1108 if (cpu != 0 && percpu_read(node_number) == 0 && ··· 1143 1143 /* 1144 1144 * set up and load the per-CPU TSS 1145 1145 */ 1146 - if (!orig_ist->ist[0]) { 1146 + if (!oist->ist[0]) { 1147 1147 char *estacks = per_cpu(exception_stacks, cpu); 1148 1148 1149 1149 for (v = 0; v < N_EXCEPTION_STACKS; v++) { 1150 1150 estacks += exception_stack_sizes[v]; 1151 - orig_ist->ist[v] = t->x86_tss.ist[v] = 1151 + oist->ist[v] = t->x86_tss.ist[v] = 1152 1152 (unsigned long)estacks; 1153 1153 } 1154 1154 }
+15 -15
arch/x86/kernel/cpu/cpu_debug.c
··· 30 30 #include <asm/apic.h> 31 31 #include <asm/desc.h> 32 32 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); 35 - static DEFINE_PER_CPU(int, cpu_priv_count); 33 + static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpud_arr); 34 + static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], cpud_priv_arr); 35 + static DEFINE_PER_CPU(int, cpud_priv_count); 36 36 37 37 static DEFINE_MUTEX(cpu_debug_lock); 38 38 ··· 531 531 532 532 /* Already intialized */ 533 533 if (file == CPU_INDEX_BIT) 534 - if (per_cpu(cpu_arr[type].init, cpu)) 534 + if (per_cpu(cpud_arr[type].init, cpu)) 535 535 return 0; 536 536 537 537 priv = kzalloc(sizeof(*priv), GFP_KERNEL); ··· 543 543 priv->reg = reg; 544 544 priv->file = file; 545 545 mutex_lock(&cpu_debug_lock); 546 - per_cpu(priv_arr[type], cpu) = priv; 547 - per_cpu(cpu_priv_count, cpu)++; 546 + per_cpu(cpud_priv_arr[type], cpu) = priv; 547 + per_cpu(cpud_priv_count, cpu)++; 548 548 mutex_unlock(&cpu_debug_lock); 549 549 550 550 if (file) ··· 552 552 dentry, (void *)priv, &cpu_fops); 553 553 else { 554 554 debugfs_create_file(cpu_base[type].name, S_IRUGO, 555 - per_cpu(cpu_arr[type].dentry, cpu), 555 + per_cpu(cpud_arr[type].dentry, cpu), 556 556 (void *)priv, &cpu_fops); 557 557 mutex_lock(&cpu_debug_lock); 558 - per_cpu(cpu_arr[type].init, cpu) = 1; 558 + per_cpu(cpud_arr[type].init, cpu) = 1; 559 559 mutex_unlock(&cpu_debug_lock); 560 560 } 561 561 ··· 615 615 if (!is_typeflag_valid(cpu, cpu_base[type].flag)) 616 616 continue; 617 617 cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry); 618 - per_cpu(cpu_arr[type].dentry, cpu) = cpu_dentry; 618 + per_cpu(cpud_arr[type].dentry, cpu) = cpu_dentry; 619 619 620 620 if (type < CPU_TSS_BIT) 621 621 err = cpu_init_msr(cpu, type, cpu_dentry); ··· 647 647 err = cpu_init_allreg(cpu, cpu_dentry); 648 648 649 649 pr_info("cpu%d(%d) debug files %d\n", 650 - cpu, nr_cpu_ids, per_cpu(cpu_priv_count, cpu)); 651 - if (per_cpu(cpu_priv_count, cpu) > MAX_CPU_FILES) { 650 + cpu, nr_cpu_ids, per_cpu(cpud_priv_count, cpu)); 651 + if (per_cpu(cpud_priv_count, cpu) > MAX_CPU_FILES) { 652 652 pr_err("Register files count %d exceeds limit %d\n", 653 - per_cpu(cpu_priv_count, cpu), MAX_CPU_FILES); 654 - per_cpu(cpu_priv_count, cpu) = MAX_CPU_FILES; 653 + per_cpu(cpud_priv_count, cpu), MAX_CPU_FILES); 654 + per_cpu(cpud_priv_count, cpu) = MAX_CPU_FILES; 655 655 err = -ENFILE; 656 656 } 657 657 if (err) ··· 676 676 debugfs_remove_recursive(cpu_debugfs_dir); 677 677 678 678 for (cpu = 0; cpu < nr_cpu_ids; cpu++) 679 - for (i = 0; i < per_cpu(cpu_priv_count, cpu); i++) 680 - kfree(per_cpu(priv_arr[i], cpu)); 679 + for (i = 0; i < per_cpu(cpud_priv_count, cpu); i++) 680 + kfree(per_cpu(cpud_priv_arr[i], cpu)); 681 681 } 682 682 683 683 module_init(cpu_debug_init);
+14 -14
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
··· 68 68 unsigned int cpu_feature; 69 69 }; 70 70 71 - static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); 71 + static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data); 72 72 73 - static DEFINE_PER_CPU(struct aperfmperf, old_perf); 73 + static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf); 74 74 75 75 /* acpi_perf_data is a pointer to percpu data. */ 76 76 static struct acpi_processor_performance *acpi_perf_data; ··· 214 214 if (unlikely(cpumask_empty(mask))) 215 215 return 0; 216 216 217 - switch (per_cpu(drv_data, cpumask_first(mask))->cpu_feature) { 217 + switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) { 218 218 case SYSTEM_INTEL_MSR_CAPABLE: 219 219 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 220 220 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; 221 221 break; 222 222 case SYSTEM_IO_CAPABLE: 223 223 cmd.type = SYSTEM_IO_CAPABLE; 224 - perf = per_cpu(drv_data, cpumask_first(mask))->acpi_data; 224 + perf = per_cpu(acfreq_data, cpumask_first(mask))->acpi_data; 225 225 cmd.addr.io.port = perf->control_register.address; 226 226 cmd.addr.io.bit_width = perf->control_register.bit_width; 227 227 break; ··· 268 268 if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1)) 269 269 return 0; 270 270 271 - ratio = calc_aperfmperf_ratio(&per_cpu(old_perf, cpu), &perf); 272 - per_cpu(old_perf, cpu) = perf; 271 + ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf); 272 + per_cpu(acfreq_old_perf, cpu) = perf; 273 273 274 274 retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT; 275 275 ··· 278 278 279 279 static unsigned int get_cur_freq_on_cpu(unsigned int cpu) 280 280 { 281 - struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); 281 + struct acpi_cpufreq_data *data = per_cpu(acfreq_data, cpu); 282 282 unsigned int freq; 283 283 unsigned int cached_freq; 284 284 ··· 322 322 static int acpi_cpufreq_target(struct cpufreq_policy *policy, 323 323 unsigned int target_freq, unsigned int relation) 324 324 { 325 - struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 325 + struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); 326 326 struct acpi_processor_performance *perf; 327 327 struct cpufreq_freqs freqs; 328 328 struct drv_cmd cmd; ··· 416 416 417 417 static int acpi_cpufreq_verify(struct cpufreq_policy *policy) 418 418 { 419 - struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 419 + struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); 420 420 421 421 dprintk("acpi_cpufreq_verify\n"); 422 422 ··· 574 574 return -ENOMEM; 575 575 576 576 data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu); 577 - per_cpu(drv_data, cpu) = data; 577 + per_cpu(acfreq_data, cpu) = data; 578 578 579 579 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) 580 580 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; ··· 725 725 acpi_processor_unregister_performance(perf, cpu); 726 726 err_free: 727 727 kfree(data); 728 - per_cpu(drv_data, cpu) = NULL; 728 + per_cpu(acfreq_data, cpu) = NULL; 729 729 730 730 return result; 731 731 } 732 732 733 733 static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) 734 734 { 735 - struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 735 + struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); 736 736 737 737 dprintk("acpi_cpufreq_cpu_exit\n"); 738 738 739 739 if (data) { 740 740 cpufreq_frequency_table_put_attr(policy->cpu); 741 - per_cpu(drv_data, policy->cpu) = NULL; 741 + per_cpu(acfreq_data, policy->cpu) = NULL; 742 742 acpi_processor_unregister_performance(data->acpi_data, 743 743 policy->cpu); 744 744 kfree(data); ··· 749 749 750 750 static int acpi_cpufreq_resume(struct cpufreq_policy *policy) 751 751 { 752 - struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 752 + struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); 753 753 754 754 dprintk("acpi_cpufreq_resume\n"); 755 755
+27 -27
arch/x86/kernel/cpu/intel_cacheinfo.c
··· 499 499 #ifdef CONFIG_SYSFS 500 500 501 501 /* pointer to _cpuid4_info array (for each cache leaf) */ 502 - static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); 503 - #define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) 502 + static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info); 503 + #define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y])) 504 504 505 505 #ifdef CONFIG_SMP 506 506 static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) ··· 513 513 if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) { 514 514 struct cpuinfo_x86 *d; 515 515 for_each_online_cpu(i) { 516 - if (!per_cpu(cpuid4_info, i)) 516 + if (!per_cpu(ici_cpuid4_info, i)) 517 517 continue; 518 518 d = &cpu_data(i); 519 519 this_leaf = CPUID4_INFO_IDX(i, index); ··· 535 535 c->apicid >> index_msb) { 536 536 cpumask_set_cpu(i, 537 537 to_cpumask(this_leaf->shared_cpu_map)); 538 - if (i != cpu && per_cpu(cpuid4_info, i)) { 538 + if (i != cpu && per_cpu(ici_cpuid4_info, i)) { 539 539 sibling_leaf = 540 540 CPUID4_INFO_IDX(i, index); 541 541 cpumask_set_cpu(cpu, to_cpumask( ··· 574 574 for (i = 0; i < num_cache_leaves; i++) 575 575 cache_remove_shared_cpu_map(cpu, i); 576 576 577 - kfree(per_cpu(cpuid4_info, cpu)); 578 - per_cpu(cpuid4_info, cpu) = NULL; 577 + kfree(per_cpu(ici_cpuid4_info, cpu)); 578 + per_cpu(ici_cpuid4_info, cpu) = NULL; 579 579 } 580 580 581 581 static int ··· 614 614 if (num_cache_leaves == 0) 615 615 return -ENOENT; 616 616 617 - per_cpu(cpuid4_info, cpu) = kzalloc( 617 + per_cpu(ici_cpuid4_info, cpu) = kzalloc( 618 618 sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL); 619 - if (per_cpu(cpuid4_info, cpu) == NULL) 619 + if (per_cpu(ici_cpuid4_info, cpu) == NULL) 620 620 return -ENOMEM; 621 621 622 622 smp_call_function_single(cpu, get_cpu_leaves, &retval, true); 623 623 if (retval) { 624 - kfree(per_cpu(cpuid4_info, cpu)); 625 - per_cpu(cpuid4_info, cpu) = NULL; 624 + kfree(per_cpu(ici_cpuid4_info, cpu)); 625 + per_cpu(ici_cpuid4_info, cpu) = NULL; 626 626 } 627 627 628 628 return retval; ··· 634 634 extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */ 635 635 636 636 /* pointer to kobject for cpuX/cache */ 637 - static DEFINE_PER_CPU(struct kobject *, cache_kobject); 637 + static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); 638 638 639 639 struct _index_kobject { 640 640 struct kobject kobj; ··· 643 643 }; 644 644 645 645 /* pointer to array of kobjects for cpuX/cache/indexY */ 646 - static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); 647 - #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) 646 + static DEFINE_PER_CPU(struct _index_kobject *, ici_index_kobject); 647 + #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(ici_index_kobject, x))[y])) 648 648 649 649 #define show_one_plus(file_name, object, val) \ 650 650 static ssize_t show_##file_name \ ··· 863 863 864 864 static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu) 865 865 { 866 - kfree(per_cpu(cache_kobject, cpu)); 867 - kfree(per_cpu(index_kobject, cpu)); 868 - per_cpu(cache_kobject, cpu) = NULL; 869 - per_cpu(index_kobject, cpu) = NULL; 866 + kfree(per_cpu(ici_cache_kobject, cpu)); 867 + kfree(per_cpu(ici_index_kobject, cpu)); 868 + per_cpu(ici_cache_kobject, cpu) = NULL; 869 + per_cpu(ici_index_kobject, cpu) = NULL; 870 870 free_cache_attributes(cpu); 871 871 } 872 872 ··· 882 882 return err; 883 883 884 884 /* Allocate all required memory */ 885 - per_cpu(cache_kobject, cpu) = 885 + per_cpu(ici_cache_kobject, cpu) = 886 886 kzalloc(sizeof(struct kobject), GFP_KERNEL); 887 - if (unlikely(per_cpu(cache_kobject, cpu) == NULL)) 887 + if (unlikely(per_cpu(ici_cache_kobject, cpu) == NULL)) 888 888 goto err_out; 889 889 890 - per_cpu(index_kobject, cpu) = kzalloc( 890 + per_cpu(ici_index_kobject, cpu) = kzalloc( 891 891 sizeof(struct _index_kobject) * num_cache_leaves, GFP_KERNEL); 892 - if (unlikely(per_cpu(index_kobject, cpu) == NULL)) 892 + if (unlikely(per_cpu(ici_index_kobject, cpu) == NULL)) 893 893 goto err_out; 894 894 895 895 return 0; ··· 913 913 if (unlikely(retval < 0)) 914 914 return retval; 915 915 916 - retval = kobject_init_and_add(per_cpu(cache_kobject, cpu), 916 + retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), 917 917 &ktype_percpu_entry, 918 918 &sys_dev->kobj, "%s", "cache"); 919 919 if (retval < 0) { ··· 927 927 this_object->index = i; 928 928 retval = kobject_init_and_add(&(this_object->kobj), 929 929 &ktype_cache, 930 - per_cpu(cache_kobject, cpu), 930 + per_cpu(ici_cache_kobject, cpu), 931 931 "index%1lu", i); 932 932 if (unlikely(retval)) { 933 933 for (j = 0; j < i; j++) 934 934 kobject_put(&(INDEX_KOBJECT_PTR(cpu, j)->kobj)); 935 - kobject_put(per_cpu(cache_kobject, cpu)); 935 + kobject_put(per_cpu(ici_cache_kobject, cpu)); 936 936 cpuid4_cache_sysfs_exit(cpu); 937 937 return retval; 938 938 } ··· 940 940 } 941 941 cpumask_set_cpu(cpu, to_cpumask(cache_dev_map)); 942 942 943 - kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD); 943 + kobject_uevent(per_cpu(ici_cache_kobject, cpu), KOBJ_ADD); 944 944 return 0; 945 945 } 946 946 ··· 949 949 unsigned int cpu = sys_dev->id; 950 950 unsigned long i; 951 951 952 - if (per_cpu(cpuid4_info, cpu) == NULL) 952 + if (per_cpu(ici_cpuid4_info, cpu) == NULL) 953 953 return; 954 954 if (!cpumask_test_cpu(cpu, to_cpumask(cache_dev_map))) 955 955 return; ··· 957 957 958 958 for (i = 0; i < num_cache_leaves; i++) 959 959 kobject_put(&(INDEX_KOBJECT_PTR(cpu, i)->kobj)); 960 - kobject_put(per_cpu(cache_kobject, cpu)); 960 + kobject_put(per_cpu(ici_cache_kobject, cpu)); 961 961 cpuid4_cache_sysfs_exit(cpu); 962 962 } 963 963
+2 -2
arch/x86/kernel/ds.c
··· 265 265 int cpu; 266 266 }; 267 267 268 - static DEFINE_PER_CPU(struct ds_context *, cpu_context); 268 + static DEFINE_PER_CPU(struct ds_context *, cpu_ds_context); 269 269 270 270 271 271 static struct ds_context *ds_get_context(struct task_struct *task, int cpu) 272 272 { 273 273 struct ds_context **p_context = 274 - (task ? &task->thread.ds_ctx : &per_cpu(cpu_context, cpu)); 274 + (task ? &task->thread.ds_ctx : &per_cpu(cpu_ds_context, cpu)); 275 275 struct ds_context *context = NULL; 276 276 struct ds_context *new_context = NULL; 277 277
+31 -33
arch/x86/kvm/svm.c
··· 316 316 static int svm_hardware_enable(void *garbage) 317 317 { 318 318 319 - struct svm_cpu_data *svm_data; 319 + struct svm_cpu_data *sd; 320 320 uint64_t efer; 321 321 struct descriptor_table gdt_descr; 322 322 struct desc_struct *gdt; ··· 331 331 me); 332 332 return -EINVAL; 333 333 } 334 - svm_data = per_cpu(svm_data, me); 334 + sd = per_cpu(svm_data, me); 335 335 336 - if (!svm_data) { 336 + if (!sd) { 337 337 printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n", 338 338 me); 339 339 return -EINVAL; 340 340 } 341 341 342 - svm_data->asid_generation = 1; 343 - svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; 344 - svm_data->next_asid = svm_data->max_asid + 1; 342 + sd->asid_generation = 1; 343 + sd->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; 344 + sd->next_asid = sd->max_asid + 1; 345 345 346 346 kvm_get_gdt(&gdt_descr); 347 347 gdt = (struct desc_struct *)gdt_descr.base; 348 - svm_data->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); 348 + sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); 349 349 350 350 wrmsrl(MSR_EFER, efer | EFER_SVME); 351 351 352 - wrmsrl(MSR_VM_HSAVE_PA, 353 - page_to_pfn(svm_data->save_area) << PAGE_SHIFT); 352 + wrmsrl(MSR_VM_HSAVE_PA, page_to_pfn(sd->save_area) << PAGE_SHIFT); 354 353 355 354 return 0; 356 355 } 357 356 358 357 static void svm_cpu_uninit(int cpu) 359 358 { 360 - struct svm_cpu_data *svm_data 361 - = per_cpu(svm_data, raw_smp_processor_id()); 359 + struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id()); 362 360 363 - if (!svm_data) 361 + if (!sd) 364 362 return; 365 363 366 364 per_cpu(svm_data, raw_smp_processor_id()) = NULL; 367 - __free_page(svm_data->save_area); 368 - kfree(svm_data); 365 + __free_page(sd->save_area); 366 + kfree(sd); 369 367 } 370 368 371 369 static int svm_cpu_init(int cpu) 372 370 { 373 - struct svm_cpu_data *svm_data; 371 + struct svm_cpu_data *sd; 374 372 int r; 375 373 376 - svm_data = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); 377 - if (!svm_data) 374 + sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); 375 + if (!sd) 378 376 return -ENOMEM; 379 - svm_data->cpu = cpu; 380 - svm_data->save_area = alloc_page(GFP_KERNEL); 377 + sd->cpu = cpu; 378 + sd->save_area = alloc_page(GFP_KERNEL); 381 379 r = -ENOMEM; 382 - if (!svm_data->save_area) 380 + if (!sd->save_area) 383 381 goto err_1; 384 382 385 - per_cpu(svm_data, cpu) = svm_data; 383 + per_cpu(svm_data, cpu) = sd; 386 384 387 385 return 0; 388 386 389 387 err_1: 390 - kfree(svm_data); 388 + kfree(sd); 391 389 return r; 392 390 393 391 } ··· 1090 1092 #endif 1091 1093 } 1092 1094 1093 - static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *svm_data) 1095 + static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) 1094 1096 { 1095 - if (svm_data->next_asid > svm_data->max_asid) { 1096 - ++svm_data->asid_generation; 1097 - svm_data->next_asid = 1; 1097 + if (sd->next_asid > sd->max_asid) { 1098 + ++sd->asid_generation; 1099 + sd->next_asid = 1; 1098 1100 svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; 1099 1101 } 1100 1102 1101 - svm->asid_generation = svm_data->asid_generation; 1102 - svm->vmcb->control.asid = svm_data->next_asid++; 1103 + svm->asid_generation = sd->asid_generation; 1104 + svm->vmcb->control.asid = sd->next_asid++; 1103 1105 } 1104 1106 1105 1107 static unsigned long svm_get_dr(struct kvm_vcpu *vcpu, int dr) ··· 2427 2429 { 2428 2430 int cpu = raw_smp_processor_id(); 2429 2431 2430 - struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); 2431 - svm_data->tss_desc->type = 9; /* available 32/64-bit TSS */ 2432 + struct svm_cpu_data *sd = per_cpu(svm_data, cpu); 2433 + sd->tss_desc->type = 9; /* available 32/64-bit TSS */ 2432 2434 load_TR_desc(); 2433 2435 } 2434 2436 ··· 2436 2438 { 2437 2439 int cpu = raw_smp_processor_id(); 2438 2440 2439 - struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); 2441 + struct svm_cpu_data *sd = per_cpu(svm_data, cpu); 2440 2442 2441 2443 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; 2442 2444 /* FIXME: handle wraparound of asid_generation */ 2443 - if (svm->asid_generation != svm_data->asid_generation) 2444 - new_asid(svm, svm_data); 2445 + if (svm->asid_generation != sd->asid_generation) 2446 + new_asid(svm, sd); 2445 2447 } 2446 2448 2447 2449 static void svm_inject_nmi(struct kvm_vcpu *vcpu)
+21 -20
arch/x86/xen/smp.c
··· 35 35 36 36 cpumask_var_t xen_cpu_initialized_map; 37 37 38 - static DEFINE_PER_CPU(int, resched_irq); 39 - static DEFINE_PER_CPU(int, callfunc_irq); 40 - static DEFINE_PER_CPU(int, callfuncsingle_irq); 41 - static DEFINE_PER_CPU(int, debug_irq) = -1; 38 + static DEFINE_PER_CPU(int, xen_resched_irq); 39 + static DEFINE_PER_CPU(int, xen_callfunc_irq); 40 + static DEFINE_PER_CPU(int, xen_callfuncsingle_irq); 41 + static DEFINE_PER_CPU(int, xen_debug_irq) = -1; 42 42 43 43 static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); 44 44 static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); ··· 103 103 NULL); 104 104 if (rc < 0) 105 105 goto fail; 106 - per_cpu(resched_irq, cpu) = rc; 106 + per_cpu(xen_resched_irq, cpu) = rc; 107 107 108 108 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); 109 109 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, ··· 114 114 NULL); 115 115 if (rc < 0) 116 116 goto fail; 117 - per_cpu(callfunc_irq, cpu) = rc; 117 + per_cpu(xen_callfunc_irq, cpu) = rc; 118 118 119 119 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 120 120 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, ··· 122 122 debug_name, NULL); 123 123 if (rc < 0) 124 124 goto fail; 125 - per_cpu(debug_irq, cpu) = rc; 125 + per_cpu(xen_debug_irq, cpu) = rc; 126 126 127 127 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); 128 128 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, ··· 133 133 NULL); 134 134 if (rc < 0) 135 135 goto fail; 136 - per_cpu(callfuncsingle_irq, cpu) = rc; 136 + per_cpu(xen_callfuncsingle_irq, cpu) = rc; 137 137 138 138 return 0; 139 139 140 140 fail: 141 - if (per_cpu(resched_irq, cpu) >= 0) 142 - unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); 143 - if (per_cpu(callfunc_irq, cpu) >= 0) 144 - unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); 145 - if (per_cpu(debug_irq, cpu) >= 0) 146 - unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); 147 - if (per_cpu(callfuncsingle_irq, cpu) >= 0) 148 - unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); 141 + if (per_cpu(xen_resched_irq, cpu) >= 0) 142 + unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); 143 + if (per_cpu(xen_callfunc_irq, cpu) >= 0) 144 + unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); 145 + if (per_cpu(xen_debug_irq, cpu) >= 0) 146 + unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); 147 + if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0) 148 + unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), 149 + NULL); 149 150 150 151 return rc; 151 152 } ··· 350 349 current->state = TASK_UNINTERRUPTIBLE; 351 350 schedule_timeout(HZ/10); 352 351 } 353 - unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); 354 - unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); 355 - unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); 356 - unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); 352 + unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); 353 + unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); 354 + unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); 355 + unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL); 357 356 xen_uninit_lock_cpu(cpu); 358 357 xen_teardown_timer(cpu); 359 358
+12 -12
arch/x86/xen/time.c
··· 31 31 #define NS_PER_TICK (1000000000LL / HZ) 32 32 33 33 /* runstate info updated by Xen */ 34 - static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); 34 + static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate); 35 35 36 36 /* snapshots of runstate info */ 37 - static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate_snapshot); 37 + static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); 38 38 39 39 /* unused ns of stolen and blocked time */ 40 - static DEFINE_PER_CPU(u64, residual_stolen); 41 - static DEFINE_PER_CPU(u64, residual_blocked); 40 + static DEFINE_PER_CPU(u64, xen_residual_stolen); 41 + static DEFINE_PER_CPU(u64, xen_residual_blocked); 42 42 43 43 /* return an consistent snapshot of 64-bit time/counter value */ 44 44 static u64 get64(const u64 *p) ··· 79 79 80 80 BUG_ON(preemptible()); 81 81 82 - state = &__get_cpu_var(runstate); 82 + state = &__get_cpu_var(xen_runstate); 83 83 84 84 /* 85 85 * The runstate info is always updated by the hypervisor on ··· 97 97 /* return true when a vcpu could run but has no real cpu to run on */ 98 98 bool xen_vcpu_stolen(int vcpu) 99 99 { 100 - return per_cpu(runstate, vcpu).state == RUNSTATE_runnable; 100 + return per_cpu(xen_runstate, vcpu).state == RUNSTATE_runnable; 101 101 } 102 102 103 103 void xen_setup_runstate_info(int cpu) 104 104 { 105 105 struct vcpu_register_runstate_memory_area area; 106 106 107 - area.addr.v = &per_cpu(runstate, cpu); 107 + area.addr.v = &per_cpu(xen_runstate, cpu); 108 108 109 109 if (HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, 110 110 cpu, &area)) ··· 122 122 123 123 WARN_ON(state.state != RUNSTATE_running); 124 124 125 - snap = &__get_cpu_var(runstate_snapshot); 125 + snap = &__get_cpu_var(xen_runstate_snapshot); 126 126 127 127 /* work out how much time the VCPU has not been runn*ing* */ 128 128 blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked]; ··· 133 133 134 134 /* Add the appropriate number of ticks of stolen time, 135 135 including any left-overs from last time. */ 136 - stolen = runnable + offline + __get_cpu_var(residual_stolen); 136 + stolen = runnable + offline + __get_cpu_var(xen_residual_stolen); 137 137 138 138 if (stolen < 0) 139 139 stolen = 0; 140 140 141 141 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 142 - __get_cpu_var(residual_stolen) = stolen; 142 + __get_cpu_var(xen_residual_stolen) = stolen; 143 143 account_steal_ticks(ticks); 144 144 145 145 /* Add the appropriate number of ticks of blocked time, 146 146 including any left-overs from last time. */ 147 - blocked += __get_cpu_var(residual_blocked); 147 + blocked += __get_cpu_var(xen_residual_blocked); 148 148 149 149 if (blocked < 0) 150 150 blocked = 0; 151 151 152 152 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked); 153 - __get_cpu_var(residual_blocked) = blocked; 153 + __get_cpu_var(xen_residual_blocked) = blocked; 154 154 account_idle_ticks(ticks); 155 155 } 156 156
+1 -1
crypto/cryptd.c
··· 99 99 struct cryptd_cpu_queue *cpu_queue; 100 100 101 101 cpu = get_cpu(); 102 - cpu_queue = per_cpu_ptr(queue->cpu_queue, cpu); 102 + cpu_queue = this_cpu_ptr(queue->cpu_queue); 103 103 err = crypto_enqueue_request(&cpu_queue->queue, request); 104 104 queue_work_on(cpu, kcrypto_wq, &cpu_queue->work); 105 105 put_cpu();
+1 -1
drivers/base/cpu.c
··· 131 131 * boot up and this data does not change there after. Hence this 132 132 * operation should be safe. No locking required. 133 133 */ 134 - addr = __pa(per_cpu_ptr(crash_notes, cpunum)); 134 + addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpunum)); 135 135 rc = sprintf(buf, "%Lx\n", addr); 136 136 return rc; 137 137 }
+8 -8
drivers/cpufreq/cpufreq.c
··· 64 64 * - Lock should not be held across 65 65 * __cpufreq_governor(data, CPUFREQ_GOV_STOP); 66 66 */ 67 - static DEFINE_PER_CPU(int, policy_cpu); 67 + static DEFINE_PER_CPU(int, cpufreq_policy_cpu); 68 68 static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem); 69 69 70 70 #define lock_policy_rwsem(mode, cpu) \ 71 71 int lock_policy_rwsem_##mode \ 72 72 (int cpu) \ 73 73 { \ 74 - int policy_cpu = per_cpu(policy_cpu, cpu); \ 74 + int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \ 75 75 BUG_ON(policy_cpu == -1); \ 76 76 down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \ 77 77 if (unlikely(!cpu_online(cpu))) { \ ··· 90 90 91 91 void unlock_policy_rwsem_read(int cpu) 92 92 { 93 - int policy_cpu = per_cpu(policy_cpu, cpu); 93 + int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); 94 94 BUG_ON(policy_cpu == -1); 95 95 up_read(&per_cpu(cpu_policy_rwsem, policy_cpu)); 96 96 } ··· 98 98 99 99 void unlock_policy_rwsem_write(int cpu) 100 100 { 101 - int policy_cpu = per_cpu(policy_cpu, cpu); 101 + int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); 102 102 BUG_ON(policy_cpu == -1); 103 103 up_write(&per_cpu(cpu_policy_rwsem, policy_cpu)); 104 104 } ··· 818 818 819 819 /* Set proper policy_cpu */ 820 820 unlock_policy_rwsem_write(cpu); 821 - per_cpu(policy_cpu, cpu) = managed_policy->cpu; 821 + per_cpu(cpufreq_policy_cpu, cpu) = managed_policy->cpu; 822 822 823 823 if (lock_policy_rwsem_write(cpu) < 0) { 824 824 /* Should not go through policy unlock path */ ··· 932 932 if (!cpu_online(j)) 933 933 continue; 934 934 per_cpu(cpufreq_cpu_data, j) = policy; 935 - per_cpu(policy_cpu, j) = policy->cpu; 935 + per_cpu(cpufreq_policy_cpu, j) = policy->cpu; 936 936 } 937 937 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 938 938 ··· 1020 1020 cpumask_copy(policy->cpus, cpumask_of(cpu)); 1021 1021 1022 1022 /* Initially set CPU itself as the policy_cpu */ 1023 - per_cpu(policy_cpu, cpu) = cpu; 1023 + per_cpu(cpufreq_policy_cpu, cpu) = cpu; 1024 1024 ret = (lock_policy_rwsem_write(cpu) < 0); 1025 1025 WARN_ON(ret); 1026 1026 ··· 2002 2002 int cpu; 2003 2003 2004 2004 for_each_possible_cpu(cpu) { 2005 - per_cpu(policy_cpu, cpu) = -1; 2005 + per_cpu(cpufreq_policy_cpu, cpu) = -1; 2006 2006 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); 2007 2007 } 2008 2008
+6 -6
drivers/cpufreq/freq_table.c
··· 174 174 } 175 175 EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); 176 176 177 - static DEFINE_PER_CPU(struct cpufreq_frequency_table *, show_table); 177 + static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); 178 178 /** 179 179 * show_available_freqs - show available frequencies for the specified CPU 180 180 */ ··· 185 185 ssize_t count = 0; 186 186 struct cpufreq_frequency_table *table; 187 187 188 - if (!per_cpu(show_table, cpu)) 188 + if (!per_cpu(cpufreq_show_table, cpu)) 189 189 return -ENODEV; 190 190 191 - table = per_cpu(show_table, cpu); 191 + table = per_cpu(cpufreq_show_table, cpu); 192 192 193 193 for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 194 194 if (table[i].frequency == CPUFREQ_ENTRY_INVALID) ··· 217 217 unsigned int cpu) 218 218 { 219 219 dprintk("setting show_table for cpu %u to %p\n", cpu, table); 220 - per_cpu(show_table, cpu) = table; 220 + per_cpu(cpufreq_show_table, cpu) = table; 221 221 } 222 222 EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_attr); 223 223 224 224 void cpufreq_frequency_table_put_attr(unsigned int cpu) 225 225 { 226 226 dprintk("clearing show_table for cpu %u\n", cpu); 227 - per_cpu(show_table, cpu) = NULL; 227 + per_cpu(cpufreq_show_table, cpu) = NULL; 228 228 } 229 229 EXPORT_SYMBOL_GPL(cpufreq_frequency_table_put_attr); 230 230 231 231 struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) 232 232 { 233 - return per_cpu(show_table, cpu); 233 + return per_cpu(cpufreq_show_table, cpu); 234 234 } 235 235 EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); 236 236
+6 -6
drivers/crypto/padlock-aes.c
··· 64 64 u32 *D; 65 65 }; 66 66 67 - static DEFINE_PER_CPU(struct cword *, last_cword); 67 + static DEFINE_PER_CPU(struct cword *, paes_last_cword); 68 68 69 69 /* Tells whether the ACE is capable to generate 70 70 the extended key for a given key_len. */ ··· 152 152 153 153 ok: 154 154 for_each_online_cpu(cpu) 155 - if (&ctx->cword.encrypt == per_cpu(last_cword, cpu) || 156 - &ctx->cword.decrypt == per_cpu(last_cword, cpu)) 157 - per_cpu(last_cword, cpu) = NULL; 155 + if (&ctx->cword.encrypt == per_cpu(paes_last_cword, cpu) || 156 + &ctx->cword.decrypt == per_cpu(paes_last_cword, cpu)) 157 + per_cpu(paes_last_cword, cpu) = NULL; 158 158 159 159 return 0; 160 160 } ··· 166 166 { 167 167 int cpu = raw_smp_processor_id(); 168 168 169 - if (cword != per_cpu(last_cword, cpu)) 169 + if (cword != per_cpu(paes_last_cword, cpu)) 170 170 #ifndef CONFIG_X86_64 171 171 asm volatile ("pushfl; popfl"); 172 172 #else ··· 176 176 177 177 static inline void padlock_store_cword(struct cword *cword) 178 178 { 179 - per_cpu(last_cword, raw_smp_processor_id()) = cword; 179 + per_cpu(paes_last_cword, raw_smp_processor_id()) = cword; 180 180 } 181 181 182 182 /*
+13 -23
drivers/dma/dmaengine.c
··· 326 326 */ 327 327 struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) 328 328 { 329 - struct dma_chan *chan; 330 - int cpu; 331 - 332 - cpu = get_cpu(); 333 - chan = per_cpu_ptr(channel_table[tx_type], cpu)->chan; 334 - put_cpu(); 335 - 336 - return chan; 329 + return this_cpu_read(channel_table[tx_type]->chan); 337 330 } 338 331 EXPORT_SYMBOL(dma_find_channel); 339 332 ··· 850 857 struct dma_async_tx_descriptor *tx; 851 858 dma_addr_t dma_dest, dma_src; 852 859 dma_cookie_t cookie; 853 - int cpu; 854 860 unsigned long flags; 855 861 856 862 dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); ··· 868 876 tx->callback = NULL; 869 877 cookie = tx->tx_submit(tx); 870 878 871 - cpu = get_cpu(); 872 - per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; 873 - per_cpu_ptr(chan->local, cpu)->memcpy_count++; 874 - put_cpu(); 879 + preempt_disable(); 880 + __this_cpu_add(chan->local->bytes_transferred, len); 881 + __this_cpu_inc(chan->local->memcpy_count); 882 + preempt_enable(); 875 883 876 884 return cookie; 877 885 } ··· 898 906 struct dma_async_tx_descriptor *tx; 899 907 dma_addr_t dma_dest, dma_src; 900 908 dma_cookie_t cookie; 901 - int cpu; 902 909 unsigned long flags; 903 910 904 911 dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); ··· 914 923 tx->callback = NULL; 915 924 cookie = tx->tx_submit(tx); 916 925 917 - cpu = get_cpu(); 918 - per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; 919 - per_cpu_ptr(chan->local, cpu)->memcpy_count++; 920 - put_cpu(); 926 + preempt_disable(); 927 + __this_cpu_add(chan->local->bytes_transferred, len); 928 + __this_cpu_inc(chan->local->memcpy_count); 929 + preempt_enable(); 921 930 922 931 return cookie; 923 932 } ··· 946 955 struct dma_async_tx_descriptor *tx; 947 956 dma_addr_t dma_dest, dma_src; 948 957 dma_cookie_t cookie; 949 - int cpu; 950 958 unsigned long flags; 951 959 952 960 dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); ··· 963 973 tx->callback = NULL; 964 974 cookie = tx->tx_submit(tx); 965 975 966 - cpu = get_cpu(); 967 - per_cpu_ptr(chan->local, cpu)->bytes_transferred += len; 968 - per_cpu_ptr(chan->local, cpu)->memcpy_count++; 969 - put_cpu(); 976 + preempt_disable(); 977 + __this_cpu_add(chan->local->bytes_transferred, len); 978 + __this_cpu_inc(chan->local->memcpy_count); 979 + preempt_enable(); 970 980 971 981 return cookie; 972 982 }
+1 -2
drivers/infiniband/hw/ehca/ehca_irq.c
··· 826 826 cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); 827 827 828 828 list_del(&cq->entry); 829 - __queue_comp_task(cq, per_cpu_ptr(pool->cpu_comp_tasks, 830 - smp_processor_id())); 829 + __queue_comp_task(cq, this_cpu_ptr(pool->cpu_comp_tasks)); 831 830 } 832 831 833 832 spin_unlock_irqrestore(&cct->task_lock, flags_cct);
+3 -3
drivers/lguest/x86/core.c
··· 69 69 (SWITCHER_ADDR + SHARED_SWITCHER_PAGES*PAGE_SIZE))[cpu]); 70 70 } 71 71 72 - static DEFINE_PER_CPU(struct lg_cpu *, last_cpu); 72 + static DEFINE_PER_CPU(struct lg_cpu *, lg_last_cpu); 73 73 74 74 /*S:010 75 75 * We approach the Switcher. ··· 90 90 * meanwhile). If that's not the case, we pretend everything in the 91 91 * Guest has changed. 92 92 */ 93 - if (__get_cpu_var(last_cpu) != cpu || cpu->last_pages != pages) { 94 - __get_cpu_var(last_cpu) = cpu; 93 + if (__get_cpu_var(lg_last_cpu) != cpu || cpu->last_pages != pages) { 94 + __get_cpu_var(lg_last_cpu) = cpu; 95 95 cpu->last_pages = pages; 96 96 cpu->changed = CHANGED_ALL; 97 97 }
+2 -3
drivers/net/chelsio/sge.c
··· 1378 1378 } 1379 1379 __skb_pull(skb, sizeof(*p)); 1380 1380 1381 - st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); 1381 + st = this_cpu_ptr(sge->port_stats[p->iff]); 1382 1382 1383 1383 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); 1384 1384 if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && ··· 1780 1780 { 1781 1781 struct adapter *adapter = dev->ml_priv; 1782 1782 struct sge *sge = adapter->sge; 1783 - struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], 1784 - smp_processor_id()); 1783 + struct sge_port_stats *st = this_cpu_ptr(sge->port_stats[dev->if_port]); 1785 1784 struct cpl_tx_pkt *cpl; 1786 1785 struct sk_buff *orig_skb = skb; 1787 1786 int ret;
+1 -1
drivers/net/loopback.c
··· 81 81 82 82 /* it's OK to use per_cpu_ptr() because BHs are off */ 83 83 pcpu_lstats = dev->ml_priv; 84 - lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id()); 84 + lb_stats = this_cpu_ptr(pcpu_lstats); 85 85 86 86 len = skb->len; 87 87 if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
+3 -4
drivers/net/veth.c
··· 153 153 struct net_device *rcv = NULL; 154 154 struct veth_priv *priv, *rcv_priv; 155 155 struct veth_net_stats *stats, *rcv_stats; 156 - int length, cpu; 156 + int length; 157 157 158 158 priv = netdev_priv(dev); 159 159 rcv = priv->peer; 160 160 rcv_priv = netdev_priv(rcv); 161 161 162 - cpu = smp_processor_id(); 163 - stats = per_cpu_ptr(priv->stats, cpu); 164 - rcv_stats = per_cpu_ptr(rcv_priv->stats, cpu); 162 + stats = this_cpu_ptr(priv->stats); 163 + rcv_stats = this_cpu_ptr(rcv_priv->stats); 165 164 166 165 if (!(rcv->flags & IFF_UP)) 167 166 goto tx_drop;
+9 -10
drivers/oprofile/cpu_buffer.c
··· 47 47 */ 48 48 static struct ring_buffer *op_ring_buffer_read; 49 49 static struct ring_buffer *op_ring_buffer_write; 50 - DEFINE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); 50 + DEFINE_PER_CPU(struct oprofile_cpu_buffer, op_cpu_buffer); 51 51 52 52 static void wq_sync_buffer(struct work_struct *work); 53 53 ··· 61 61 62 62 void oprofile_cpu_buffer_inc_smpl_lost(void) 63 63 { 64 - struct oprofile_cpu_buffer *cpu_buf 65 - = &__get_cpu_var(cpu_buffer); 64 + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); 66 65 67 66 cpu_buf->sample_lost_overflow++; 68 67 } ··· 94 95 goto fail; 95 96 96 97 for_each_possible_cpu(i) { 97 - struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); 98 + struct oprofile_cpu_buffer *b = &per_cpu(op_cpu_buffer, i); 98 99 99 100 b->last_task = NULL; 100 101 b->last_is_kernel = -1; ··· 121 122 work_enabled = 1; 122 123 123 124 for_each_online_cpu(i) { 124 - struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); 125 + struct oprofile_cpu_buffer *b = &per_cpu(op_cpu_buffer, i); 125 126 126 127 /* 127 128 * Spread the work by 1 jiffy per cpu so they dont all ··· 138 139 work_enabled = 0; 139 140 140 141 for_each_online_cpu(i) { 141 - struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); 142 + struct oprofile_cpu_buffer *b = &per_cpu(op_cpu_buffer, i); 142 143 143 144 cancel_delayed_work(&b->work); 144 145 } ··· 329 330 __oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, 330 331 unsigned long event, int is_kernel) 331 332 { 332 - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); 333 + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); 333 334 unsigned long backtrace = oprofile_backtrace_depth; 334 335 335 336 /* ··· 374 375 { 375 376 struct op_sample *sample; 376 377 int is_kernel = !user_mode(regs); 377 - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); 378 + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); 378 379 379 380 cpu_buf->sample_received++; 380 381 ··· 429 430 430 431 void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) 431 432 { 432 - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); 433 + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); 433 434 log_sample(cpu_buf, pc, 0, is_kernel, event); 434 435 } 435 436 436 437 void oprofile_add_trace(unsigned long pc) 437 438 { 438 - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); 439 + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); 439 440 440 441 if (!cpu_buf->tracing) 441 442 return;
+2 -2
drivers/oprofile/cpu_buffer.h
··· 50 50 struct delayed_work work; 51 51 }; 52 52 53 - DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); 53 + DECLARE_PER_CPU(struct oprofile_cpu_buffer, op_cpu_buffer); 54 54 55 55 /* 56 56 * Resets the cpu buffer to a sane state. ··· 60 60 */ 61 61 static inline void op_cpu_buffer_reset(int cpu) 62 62 { 63 - struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu); 63 + struct oprofile_cpu_buffer *cpu_buf = &per_cpu(op_cpu_buffer, cpu); 64 64 65 65 cpu_buf->last_is_kernel = -1; 66 66 cpu_buf->last_task = NULL;
+2 -2
drivers/oprofile/oprofile_stats.c
··· 23 23 int i; 24 24 25 25 for_each_possible_cpu(i) { 26 - cpu_buf = &per_cpu(cpu_buffer, i); 26 + cpu_buf = &per_cpu(op_cpu_buffer, i); 27 27 cpu_buf->sample_received = 0; 28 28 cpu_buf->sample_lost_overflow = 0; 29 29 cpu_buf->backtrace_aborted = 0; ··· 51 51 return; 52 52 53 53 for_each_possible_cpu(i) { 54 - cpu_buf = &per_cpu(cpu_buffer, i); 54 + cpu_buf = &per_cpu(op_cpu_buffer, i); 55 55 snprintf(buf, 10, "cpu%d", i); 56 56 cpudir = oprofilefs_mkdir(sb, dir, buf); 57 57
+3 -5
drivers/s390/net/netiucv.c
··· 113 113 #define IUCV_DBF_TEXT_(name, level, text...) \ 114 114 do { \ 115 115 if (iucv_dbf_passes(iucv_dbf_##name, level)) { \ 116 - char* iucv_dbf_txt_buf = \ 117 - get_cpu_var(iucv_dbf_txt_buf); \ 118 - sprintf(iucv_dbf_txt_buf, text); \ 119 - debug_text_event(iucv_dbf_##name, level, \ 120 - iucv_dbf_txt_buf); \ 116 + char* __buf = get_cpu_var(iucv_dbf_txt_buf); \ 117 + sprintf(__buf, text); \ 118 + debug_text_event(iucv_dbf_##name, level, __buf); \ 121 119 put_cpu_var(iucv_dbf_txt_buf); \ 122 120 } \ 123 121 } while (0)
+1 -1
fs/ext4/mballoc.c
··· 3955 3955 * per cpu locality group is to reduce the contention between block 3956 3956 * request from multiple CPUs. 3957 3957 */ 3958 - ac->ac_lg = per_cpu_ptr(sbi->s_locality_groups, raw_smp_processor_id()); 3958 + ac->ac_lg = __this_cpu_ptr(sbi->s_locality_groups); 3959 3959 3960 3960 /* we're going to use group allocation */ 3961 3961 ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;
+3 -21
fs/nfs/iostat.h
··· 25 25 static inline void nfs_inc_server_stats(const struct nfs_server *server, 26 26 enum nfs_stat_eventcounters stat) 27 27 { 28 - struct nfs_iostats *iostats; 29 - int cpu; 30 - 31 - cpu = get_cpu(); 32 - iostats = per_cpu_ptr(server->io_stats, cpu); 33 - iostats->events[stat]++; 34 - put_cpu(); 28 + this_cpu_inc(server->io_stats->events[stat]); 35 29 } 36 30 37 31 static inline void nfs_inc_stats(const struct inode *inode, ··· 38 44 enum nfs_stat_bytecounters stat, 39 45 unsigned long addend) 40 46 { 41 - struct nfs_iostats *iostats; 42 - int cpu; 43 - 44 - cpu = get_cpu(); 45 - iostats = per_cpu_ptr(server->io_stats, cpu); 46 - iostats->bytes[stat] += addend; 47 - put_cpu(); 47 + this_cpu_add(server->io_stats->bytes[stat], addend); 48 48 } 49 49 50 50 static inline void nfs_add_stats(const struct inode *inode, ··· 53 65 enum nfs_stat_fscachecounters stat, 54 66 unsigned long addend) 55 67 { 56 - struct nfs_iostats *iostats; 57 - int cpu; 58 - 59 - cpu = get_cpu(); 60 - iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu); 61 - iostats->fscache[stat] += addend; 62 - put_cpu(); 68 + this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend); 63 69 } 64 70 #endif 65 71
+6 -6
fs/xfs/xfs_mount.c
··· 2389 2389 { 2390 2390 xfs_icsb_cnts_t *icsbp; 2391 2391 long long lcounter; /* long counter for 64 bit fields */ 2392 - int cpu, ret = 0; 2392 + int ret = 0; 2393 2393 2394 2394 might_sleep(); 2395 2395 again: 2396 - cpu = get_cpu(); 2397 - icsbp = (xfs_icsb_cnts_t *)per_cpu_ptr(mp->m_sb_cnts, cpu); 2396 + preempt_disable(); 2397 + icsbp = this_cpu_ptr(mp->m_sb_cnts); 2398 2398 2399 2399 /* 2400 2400 * if the counter is disabled, go to slow path ··· 2438 2438 break; 2439 2439 } 2440 2440 xfs_icsb_unlock_cntr(icsbp); 2441 - put_cpu(); 2441 + preempt_enable(); 2442 2442 return 0; 2443 2443 2444 2444 slow_path: 2445 - put_cpu(); 2445 + preempt_enable(); 2446 2446 2447 2447 /* 2448 2448 * serialise with a mutex so we don't burn lots of cpu on ··· 2490 2490 2491 2491 balance_counter: 2492 2492 xfs_icsb_unlock_cntr(icsbp); 2493 - put_cpu(); 2493 + preempt_enable(); 2494 2494 2495 2495 /* 2496 2496 * We may have multiple threads here if multiple per-cpu
+5
include/asm-generic/percpu.h
··· 56 56 #define __raw_get_cpu_var(var) \ 57 57 (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) 58 58 59 + #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 60 + #define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) 61 + 59 62 60 63 #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 61 64 extern void setup_per_cpu_areas(void); ··· 69 66 #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) 70 67 #define __get_cpu_var(var) per_cpu_var(var) 71 68 #define __raw_get_cpu_var(var) per_cpu_var(var) 69 + #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 70 + #define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) 72 71 73 72 #endif /* SMP */ 74 73
+1
include/linux/percpu-defs.h
··· 60 60 61 61 #define DEFINE_PER_CPU_SECTION(type, name, sec) \ 62 62 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ 63 + extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ 63 64 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ 64 65 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ 65 66 __typeof__(type) per_cpu__##name
+408 -26
include/linux/percpu.h
··· 34 34 35 35 #ifdef CONFIG_SMP 36 36 37 - #ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA 38 - 39 37 /* minimum unit size, also is the maximum supported allocation size */ 40 38 #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 41 39 ··· 128 130 #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) 129 131 130 132 extern void *__alloc_reserved_percpu(size_t size, size_t align); 131 - 132 - #else /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ 133 - 134 - struct percpu_data { 135 - void *ptrs[1]; 136 - }; 137 - 138 - /* pointer disguising messes up the kmemleak objects tracking */ 139 - #ifndef CONFIG_DEBUG_KMEMLEAK 140 - #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 141 - #else 142 - #define __percpu_disguise(pdata) (struct percpu_data *)(pdata) 143 - #endif 144 - 145 - #define per_cpu_ptr(ptr, cpu) \ 146 - ({ \ 147 - struct percpu_data *__p = __percpu_disguise(ptr); \ 148 - (__typeof__(ptr))__p->ptrs[(cpu)]; \ 149 - }) 150 - 151 - #endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ 152 - 153 133 extern void *__alloc_percpu(size_t size, size_t align); 154 134 extern void free_percpu(void *__pdata); 135 + extern phys_addr_t per_cpu_ptr_to_phys(void *addr); 155 136 156 137 #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 157 138 extern void __init setup_per_cpu_areas(void); ··· 156 179 kfree(p); 157 180 } 158 181 182 + static inline phys_addr_t per_cpu_ptr_to_phys(void *addr) 183 + { 184 + return __pa(addr); 185 + } 186 + 159 187 static inline void __init setup_per_cpu_areas(void) { } 160 188 161 189 static inline void *pcpu_lpage_remapped(void *kaddr) ··· 170 188 171 189 #endif /* CONFIG_SMP */ 172 190 173 - #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ 174 - __alignof__(type)) 191 + #define alloc_percpu(type) \ 192 + (typeof(type) *)__alloc_percpu(sizeof(type), __alignof__(type)) 175 193 176 194 /* 177 195 * Optional methods for optimized non-lvalue per-cpu variable access. ··· 223 241 224 242 #ifndef percpu_xor 225 243 # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) 244 + #endif 245 + 246 + /* 247 + * Branching function to split up a function into a set of functions that 248 + * are called for different scalar sizes of the objects handled. 249 + */ 250 + 251 + extern void __bad_size_call_parameter(void); 252 + 253 + #define __pcpu_size_call_return(stem, variable) \ 254 + ({ typeof(variable) pscr_ret__; \ 255 + switch(sizeof(variable)) { \ 256 + case 1: pscr_ret__ = stem##1(variable);break; \ 257 + case 2: pscr_ret__ = stem##2(variable);break; \ 258 + case 4: pscr_ret__ = stem##4(variable);break; \ 259 + case 8: pscr_ret__ = stem##8(variable);break; \ 260 + default: \ 261 + __bad_size_call_parameter();break; \ 262 + } \ 263 + pscr_ret__; \ 264 + }) 265 + 266 + #define __pcpu_size_call(stem, variable, ...) \ 267 + do { \ 268 + switch(sizeof(variable)) { \ 269 + case 1: stem##1(variable, __VA_ARGS__);break; \ 270 + case 2: stem##2(variable, __VA_ARGS__);break; \ 271 + case 4: stem##4(variable, __VA_ARGS__);break; \ 272 + case 8: stem##8(variable, __VA_ARGS__);break; \ 273 + default: \ 274 + __bad_size_call_parameter();break; \ 275 + } \ 276 + } while (0) 277 + 278 + /* 279 + * Optimized manipulation for memory allocated through the per cpu 280 + * allocator or for addresses of per cpu variables (can be determined 281 + * using per_cpu_var(xx). 282 + * 283 + * These operation guarantee exclusivity of access for other operations 284 + * on the *same* processor. The assumption is that per cpu data is only 285 + * accessed by a single processor instance (the current one). 286 + * 287 + * The first group is used for accesses that must be done in a 288 + * preemption safe way since we know that the context is not preempt 289 + * safe. Interrupts may occur. If the interrupt modifies the variable 290 + * too then RMW actions will not be reliable. 291 + * 292 + * The arch code can provide optimized functions in two ways: 293 + * 294 + * 1. Override the function completely. F.e. define this_cpu_add(). 295 + * The arch must then ensure that the various scalar format passed 296 + * are handled correctly. 297 + * 298 + * 2. Provide functions for certain scalar sizes. F.e. provide 299 + * this_cpu_add_2() to provide per cpu atomic operations for 2 byte 300 + * sized RMW actions. If arch code does not provide operations for 301 + * a scalar size then the fallback in the generic code will be 302 + * used. 303 + */ 304 + 305 + #define _this_cpu_generic_read(pcp) \ 306 + ({ typeof(pcp) ret__; \ 307 + preempt_disable(); \ 308 + ret__ = *this_cpu_ptr(&(pcp)); \ 309 + preempt_enable(); \ 310 + ret__; \ 311 + }) 312 + 313 + #ifndef this_cpu_read 314 + # ifndef this_cpu_read_1 315 + # define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp) 316 + # endif 317 + # ifndef this_cpu_read_2 318 + # define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp) 319 + # endif 320 + # ifndef this_cpu_read_4 321 + # define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp) 322 + # endif 323 + # ifndef this_cpu_read_8 324 + # define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp) 325 + # endif 326 + # define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp)) 327 + #endif 328 + 329 + #define _this_cpu_generic_to_op(pcp, val, op) \ 330 + do { \ 331 + preempt_disable(); \ 332 + *__this_cpu_ptr(&pcp) op val; \ 333 + preempt_enable(); \ 334 + } while (0) 335 + 336 + #ifndef this_cpu_write 337 + # ifndef this_cpu_write_1 338 + # define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) 339 + # endif 340 + # ifndef this_cpu_write_2 341 + # define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) 342 + # endif 343 + # ifndef this_cpu_write_4 344 + # define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) 345 + # endif 346 + # ifndef this_cpu_write_8 347 + # define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) 348 + # endif 349 + # define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val)) 350 + #endif 351 + 352 + #ifndef this_cpu_add 353 + # ifndef this_cpu_add_1 354 + # define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) 355 + # endif 356 + # ifndef this_cpu_add_2 357 + # define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) 358 + # endif 359 + # ifndef this_cpu_add_4 360 + # define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) 361 + # endif 362 + # ifndef this_cpu_add_8 363 + # define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) 364 + # endif 365 + # define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val)) 366 + #endif 367 + 368 + #ifndef this_cpu_sub 369 + # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) 370 + #endif 371 + 372 + #ifndef this_cpu_inc 373 + # define this_cpu_inc(pcp) this_cpu_add((pcp), 1) 374 + #endif 375 + 376 + #ifndef this_cpu_dec 377 + # define this_cpu_dec(pcp) this_cpu_sub((pcp), 1) 378 + #endif 379 + 380 + #ifndef this_cpu_and 381 + # ifndef this_cpu_and_1 382 + # define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) 383 + # endif 384 + # ifndef this_cpu_and_2 385 + # define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) 386 + # endif 387 + # ifndef this_cpu_and_4 388 + # define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) 389 + # endif 390 + # ifndef this_cpu_and_8 391 + # define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) 392 + # endif 393 + # define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val)) 394 + #endif 395 + 396 + #ifndef this_cpu_or 397 + # ifndef this_cpu_or_1 398 + # define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) 399 + # endif 400 + # ifndef this_cpu_or_2 401 + # define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) 402 + # endif 403 + # ifndef this_cpu_or_4 404 + # define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) 405 + # endif 406 + # ifndef this_cpu_or_8 407 + # define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) 408 + # endif 409 + # define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) 410 + #endif 411 + 412 + #ifndef this_cpu_xor 413 + # ifndef this_cpu_xor_1 414 + # define this_cpu_xor_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) 415 + # endif 416 + # ifndef this_cpu_xor_2 417 + # define this_cpu_xor_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) 418 + # endif 419 + # ifndef this_cpu_xor_4 420 + # define this_cpu_xor_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) 421 + # endif 422 + # ifndef this_cpu_xor_8 423 + # define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) 424 + # endif 425 + # define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) 426 + #endif 427 + 428 + /* 429 + * Generic percpu operations that do not require preemption handling. 430 + * Either we do not care about races or the caller has the 431 + * responsibility of handling preemptions issues. Arch code can still 432 + * override these instructions since the arch per cpu code may be more 433 + * efficient and may actually get race freeness for free (that is the 434 + * case for x86 for example). 435 + * 436 + * If there is no other protection through preempt disable and/or 437 + * disabling interupts then one of these RMW operations can show unexpected 438 + * behavior because the execution thread was rescheduled on another processor 439 + * or an interrupt occurred and the same percpu variable was modified from 440 + * the interrupt context. 441 + */ 442 + #ifndef __this_cpu_read 443 + # ifndef __this_cpu_read_1 444 + # define __this_cpu_read_1(pcp) (*__this_cpu_ptr(&(pcp))) 445 + # endif 446 + # ifndef __this_cpu_read_2 447 + # define __this_cpu_read_2(pcp) (*__this_cpu_ptr(&(pcp))) 448 + # endif 449 + # ifndef __this_cpu_read_4 450 + # define __this_cpu_read_4(pcp) (*__this_cpu_ptr(&(pcp))) 451 + # endif 452 + # ifndef __this_cpu_read_8 453 + # define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) 454 + # endif 455 + # define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp)) 456 + #endif 457 + 458 + #define __this_cpu_generic_to_op(pcp, val, op) \ 459 + do { \ 460 + *__this_cpu_ptr(&(pcp)) op val; \ 461 + } while (0) 462 + 463 + #ifndef __this_cpu_write 464 + # ifndef __this_cpu_write_1 465 + # define __this_cpu_write_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 466 + # endif 467 + # ifndef __this_cpu_write_2 468 + # define __this_cpu_write_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 469 + # endif 470 + # ifndef __this_cpu_write_4 471 + # define __this_cpu_write_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 472 + # endif 473 + # ifndef __this_cpu_write_8 474 + # define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 475 + # endif 476 + # define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val)) 477 + #endif 478 + 479 + #ifndef __this_cpu_add 480 + # ifndef __this_cpu_add_1 481 + # define __this_cpu_add_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 482 + # endif 483 + # ifndef __this_cpu_add_2 484 + # define __this_cpu_add_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 485 + # endif 486 + # ifndef __this_cpu_add_4 487 + # define __this_cpu_add_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 488 + # endif 489 + # ifndef __this_cpu_add_8 490 + # define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 491 + # endif 492 + # define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val)) 493 + #endif 494 + 495 + #ifndef __this_cpu_sub 496 + # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) 497 + #endif 498 + 499 + #ifndef __this_cpu_inc 500 + # define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) 501 + #endif 502 + 503 + #ifndef __this_cpu_dec 504 + # define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) 505 + #endif 506 + 507 + #ifndef __this_cpu_and 508 + # ifndef __this_cpu_and_1 509 + # define __this_cpu_and_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 510 + # endif 511 + # ifndef __this_cpu_and_2 512 + # define __this_cpu_and_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 513 + # endif 514 + # ifndef __this_cpu_and_4 515 + # define __this_cpu_and_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 516 + # endif 517 + # ifndef __this_cpu_and_8 518 + # define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 519 + # endif 520 + # define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val)) 521 + #endif 522 + 523 + #ifndef __this_cpu_or 524 + # ifndef __this_cpu_or_1 525 + # define __this_cpu_or_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 526 + # endif 527 + # ifndef __this_cpu_or_2 528 + # define __this_cpu_or_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 529 + # endif 530 + # ifndef __this_cpu_or_4 531 + # define __this_cpu_or_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 532 + # endif 533 + # ifndef __this_cpu_or_8 534 + # define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 535 + # endif 536 + # define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) 537 + #endif 538 + 539 + #ifndef __this_cpu_xor 540 + # ifndef __this_cpu_xor_1 541 + # define __this_cpu_xor_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) 542 + # endif 543 + # ifndef __this_cpu_xor_2 544 + # define __this_cpu_xor_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) 545 + # endif 546 + # ifndef __this_cpu_xor_4 547 + # define __this_cpu_xor_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) 548 + # endif 549 + # ifndef __this_cpu_xor_8 550 + # define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) 551 + # endif 552 + # define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val)) 553 + #endif 554 + 555 + /* 556 + * IRQ safe versions of the per cpu RMW operations. Note that these operations 557 + * are *not* safe against modification of the same variable from another 558 + * processors (which one gets when using regular atomic operations) 559 + . They are guaranteed to be atomic vs. local interrupts and 560 + * preemption only. 561 + */ 562 + #define irqsafe_cpu_generic_to_op(pcp, val, op) \ 563 + do { \ 564 + unsigned long flags; \ 565 + local_irq_save(flags); \ 566 + *__this_cpu_ptr(&(pcp)) op val; \ 567 + local_irq_restore(flags); \ 568 + } while (0) 569 + 570 + #ifndef irqsafe_cpu_add 571 + # ifndef irqsafe_cpu_add_1 572 + # define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) 573 + # endif 574 + # ifndef irqsafe_cpu_add_2 575 + # define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) 576 + # endif 577 + # ifndef irqsafe_cpu_add_4 578 + # define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) 579 + # endif 580 + # ifndef irqsafe_cpu_add_8 581 + # define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) 582 + # endif 583 + # define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val)) 584 + #endif 585 + 586 + #ifndef irqsafe_cpu_sub 587 + # define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val)) 588 + #endif 589 + 590 + #ifndef irqsafe_cpu_inc 591 + # define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1) 592 + #endif 593 + 594 + #ifndef irqsafe_cpu_dec 595 + # define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1) 596 + #endif 597 + 598 + #ifndef irqsafe_cpu_and 599 + # ifndef irqsafe_cpu_and_1 600 + # define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) 601 + # endif 602 + # ifndef irqsafe_cpu_and_2 603 + # define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) 604 + # endif 605 + # ifndef irqsafe_cpu_and_4 606 + # define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) 607 + # endif 608 + # ifndef irqsafe_cpu_and_8 609 + # define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) 610 + # endif 611 + # define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val)) 612 + #endif 613 + 614 + #ifndef irqsafe_cpu_or 615 + # ifndef irqsafe_cpu_or_1 616 + # define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) 617 + # endif 618 + # ifndef irqsafe_cpu_or_2 619 + # define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) 620 + # endif 621 + # ifndef irqsafe_cpu_or_4 622 + # define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) 623 + # endif 624 + # ifndef irqsafe_cpu_or_8 625 + # define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) 626 + # endif 627 + # define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val)) 628 + #endif 629 + 630 + #ifndef irqsafe_cpu_xor 631 + # ifndef irqsafe_cpu_xor_1 632 + # define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) 633 + # endif 634 + # ifndef irqsafe_cpu_xor_2 635 + # define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) 636 + # endif 637 + # ifndef irqsafe_cpu_xor_4 638 + # define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) 639 + # endif 640 + # ifndef irqsafe_cpu_xor_8 641 + # define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) 642 + # endif 643 + # define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val)) 226 644 #endif 227 645 228 646 #endif /* __LINUX_PERCPU_H */
+4 -6
include/linux/vmstat.h
··· 76 76 77 77 static inline void __count_vm_event(enum vm_event_item item) 78 78 { 79 - __get_cpu_var(vm_event_states).event[item]++; 79 + __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); 80 80 } 81 81 82 82 static inline void count_vm_event(enum vm_event_item item) 83 83 { 84 - get_cpu_var(vm_event_states).event[item]++; 85 - put_cpu(); 84 + this_cpu_inc(per_cpu_var(vm_event_states).event[item]); 86 85 } 87 86 88 87 static inline void __count_vm_events(enum vm_event_item item, long delta) 89 88 { 90 - __get_cpu_var(vm_event_states).event[item] += delta; 89 + __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); 91 90 } 92 91 93 92 static inline void count_vm_events(enum vm_event_item item, long delta) 94 93 { 95 - get_cpu_var(vm_event_states).event[item] += delta; 96 - put_cpu(); 94 + this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); 97 95 } 98 96 99 97 extern void all_vm_events(unsigned long *);
+1 -6
include/net/neighbour.h
··· 88 88 unsigned long unres_discards; /* number of unresolved drops */ 89 89 }; 90 90 91 - #define NEIGH_CACHE_STAT_INC(tbl, field) \ 92 - do { \ 93 - preempt_disable(); \ 94 - (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \ 95 - preempt_enable(); \ 96 - } while (0) 91 + #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) 97 92 98 93 struct neighbour { 99 94 struct neighbour *next;
+2 -2
include/net/netfilter/nf_conntrack.h
··· 293 293 extern unsigned int nf_conntrack_max; 294 294 295 295 #define NF_CT_STAT_INC(net, count) \ 296 - (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) 296 + __this_cpu_inc((net)->ct.stat->count) 297 297 #define NF_CT_STAT_INC_ATOMIC(net, count) \ 298 298 do { \ 299 299 local_bh_disable(); \ 300 - per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ 300 + __this_cpu_inc((net)->ct.stat->count); \ 301 301 local_bh_enable(); \ 302 302 } while (0) 303 303
+18 -32
include/net/snmp.h
··· 136 136 #define SNMP_STAT_BHPTR(name) (name[0]) 137 137 #define SNMP_STAT_USRPTR(name) (name[1]) 138 138 139 - #define SNMP_INC_STATS_BH(mib, field) \ 140 - (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) 141 - #define SNMP_INC_STATS_USER(mib, field) \ 142 - do { \ 143 - per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ 144 - put_cpu(); \ 145 - } while (0) 146 - #define SNMP_INC_STATS(mib, field) \ 147 - do { \ 148 - per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ 149 - put_cpu(); \ 150 - } while (0) 151 - #define SNMP_DEC_STATS(mib, field) \ 152 - do { \ 153 - per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ 154 - put_cpu(); \ 155 - } while (0) 156 - #define SNMP_ADD_STATS(mib, field, addend) \ 157 - do { \ 158 - per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ 159 - put_cpu(); \ 160 - } while (0) 161 - #define SNMP_ADD_STATS_BH(mib, field, addend) \ 162 - (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) 163 - #define SNMP_ADD_STATS_USER(mib, field, addend) \ 164 - do { \ 165 - per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ 166 - put_cpu(); \ 167 - } while (0) 139 + #define SNMP_INC_STATS_BH(mib, field) \ 140 + __this_cpu_inc(mib[0]->mibs[field]) 141 + #define SNMP_INC_STATS_USER(mib, field) \ 142 + this_cpu_inc(mib[1]->mibs[field]) 143 + #define SNMP_INC_STATS(mib, field) \ 144 + this_cpu_inc(mib[!in_softirq()]->mibs[field]) 145 + #define SNMP_DEC_STATS(mib, field) \ 146 + this_cpu_dec(mib[!in_softirq()]->mibs[field]) 147 + #define SNMP_ADD_STATS_BH(mib, field, addend) \ 148 + __this_cpu_add(mib[0]->mibs[field], addend) 149 + #define SNMP_ADD_STATS_USER(mib, field, addend) \ 150 + this_cpu_add(mib[1]->mibs[field], addend) 168 151 #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 169 152 do { \ 170 - __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ 153 + __typeof__(mib[0]) ptr; \ 154 + preempt_disable(); \ 155 + ptr = this_cpu_ptr((mib)[!in_softirq()]); \ 171 156 ptr->mibs[basefield##PKTS]++; \ 172 157 ptr->mibs[basefield##OCTETS] += addend;\ 173 - put_cpu(); \ 158 + preempt_enable(); \ 174 159 } while (0) 175 160 #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 176 161 do { \ 177 - __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ 162 + __typeof__(mib[0]) ptr = \ 163 + __this_cpu_ptr((mib)[!in_softirq()]); \ 178 164 ptr->mibs[basefield##PKTS]++; \ 179 165 ptr->mibs[basefield##OCTETS] += addend;\ 180 166 } while (0)
+6 -5
kernel/lockdep.c
··· 140 140 } 141 141 142 142 #ifdef CONFIG_LOCK_STAT 143 - static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats); 143 + static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], 144 + cpu_lock_stats); 144 145 145 146 static inline u64 lockstat_clock(void) 146 147 { ··· 199 198 memset(&stats, 0, sizeof(struct lock_class_stats)); 200 199 for_each_possible_cpu(cpu) { 201 200 struct lock_class_stats *pcs = 202 - &per_cpu(lock_stats, cpu)[class - lock_classes]; 201 + &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; 203 202 204 203 for (i = 0; i < ARRAY_SIZE(stats.contention_point); i++) 205 204 stats.contention_point[i] += pcs->contention_point[i]; ··· 226 225 227 226 for_each_possible_cpu(cpu) { 228 227 struct lock_class_stats *cpu_stats = 229 - &per_cpu(lock_stats, cpu)[class - lock_classes]; 228 + &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; 230 229 231 230 memset(cpu_stats, 0, sizeof(struct lock_class_stats)); 232 231 } ··· 236 235 237 236 static struct lock_class_stats *get_lock_stats(struct lock_class *class) 238 237 { 239 - return &get_cpu_var(lock_stats)[class - lock_classes]; 238 + return &get_cpu_var(cpu_lock_stats)[class - lock_classes]; 240 239 } 241 240 242 241 static void put_lock_stats(struct lock_class_stats *stats) 243 242 { 244 - put_cpu_var(lock_stats); 243 + put_cpu_var(cpu_lock_stats); 245 244 } 246 245 247 246 static void lock_release_holdtime(struct held_lock *hlock)
-150
kernel/module.c
··· 370 370 371 371 #ifdef CONFIG_SMP 372 372 373 - #ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA 374 - 375 373 static void *percpu_modalloc(unsigned long size, unsigned long align, 376 374 const char *name) 377 375 { ··· 392 394 { 393 395 free_percpu(freeme); 394 396 } 395 - 396 - #else /* ... CONFIG_HAVE_LEGACY_PER_CPU_AREA */ 397 - 398 - /* Number of blocks used and allocated. */ 399 - static unsigned int pcpu_num_used, pcpu_num_allocated; 400 - /* Size of each block. -ve means used. */ 401 - static int *pcpu_size; 402 - 403 - static int split_block(unsigned int i, unsigned short size) 404 - { 405 - /* Reallocation required? */ 406 - if (pcpu_num_used + 1 > pcpu_num_allocated) { 407 - int *new; 408 - 409 - new = krealloc(pcpu_size, sizeof(new[0])*pcpu_num_allocated*2, 410 - GFP_KERNEL); 411 - if (!new) 412 - return 0; 413 - 414 - pcpu_num_allocated *= 2; 415 - pcpu_size = new; 416 - } 417 - 418 - /* Insert a new subblock */ 419 - memmove(&pcpu_size[i+1], &pcpu_size[i], 420 - sizeof(pcpu_size[0]) * (pcpu_num_used - i)); 421 - pcpu_num_used++; 422 - 423 - pcpu_size[i+1] -= size; 424 - pcpu_size[i] = size; 425 - return 1; 426 - } 427 - 428 - static inline unsigned int block_size(int val) 429 - { 430 - if (val < 0) 431 - return -val; 432 - return val; 433 - } 434 - 435 - static void *percpu_modalloc(unsigned long size, unsigned long align, 436 - const char *name) 437 - { 438 - unsigned long extra; 439 - unsigned int i; 440 - void *ptr; 441 - int cpu; 442 - 443 - if (align > PAGE_SIZE) { 444 - printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n", 445 - name, align, PAGE_SIZE); 446 - align = PAGE_SIZE; 447 - } 448 - 449 - ptr = __per_cpu_start; 450 - for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { 451 - /* Extra for alignment requirement. */ 452 - extra = ALIGN((unsigned long)ptr, align) - (unsigned long)ptr; 453 - BUG_ON(i == 0 && extra != 0); 454 - 455 - if (pcpu_size[i] < 0 || pcpu_size[i] < extra + size) 456 - continue; 457 - 458 - /* Transfer extra to previous block. */ 459 - if (pcpu_size[i-1] < 0) 460 - pcpu_size[i-1] -= extra; 461 - else 462 - pcpu_size[i-1] += extra; 463 - pcpu_size[i] -= extra; 464 - ptr += extra; 465 - 466 - /* Split block if warranted */ 467 - if (pcpu_size[i] - size > sizeof(unsigned long)) 468 - if (!split_block(i, size)) 469 - return NULL; 470 - 471 - /* add the per-cpu scanning areas */ 472 - for_each_possible_cpu(cpu) 473 - kmemleak_alloc(ptr + per_cpu_offset(cpu), size, 0, 474 - GFP_KERNEL); 475 - 476 - /* Mark allocated */ 477 - pcpu_size[i] = -pcpu_size[i]; 478 - return ptr; 479 - } 480 - 481 - printk(KERN_WARNING "Could not allocate %lu bytes percpu data\n", 482 - size); 483 - return NULL; 484 - } 485 - 486 - static void percpu_modfree(void *freeme) 487 - { 488 - unsigned int i; 489 - void *ptr = __per_cpu_start + block_size(pcpu_size[0]); 490 - int cpu; 491 - 492 - /* First entry is core kernel percpu data. */ 493 - for (i = 1; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { 494 - if (ptr == freeme) { 495 - pcpu_size[i] = -pcpu_size[i]; 496 - goto free; 497 - } 498 - } 499 - BUG(); 500 - 501 - free: 502 - /* remove the per-cpu scanning areas */ 503 - for_each_possible_cpu(cpu) 504 - kmemleak_free(freeme + per_cpu_offset(cpu)); 505 - 506 - /* Merge with previous? */ 507 - if (pcpu_size[i-1] >= 0) { 508 - pcpu_size[i-1] += pcpu_size[i]; 509 - pcpu_num_used--; 510 - memmove(&pcpu_size[i], &pcpu_size[i+1], 511 - (pcpu_num_used - i) * sizeof(pcpu_size[0])); 512 - i--; 513 - } 514 - /* Merge with next? */ 515 - if (i+1 < pcpu_num_used && pcpu_size[i+1] >= 0) { 516 - pcpu_size[i] += pcpu_size[i+1]; 517 - pcpu_num_used--; 518 - memmove(&pcpu_size[i+1], &pcpu_size[i+2], 519 - (pcpu_num_used - (i+1)) * sizeof(pcpu_size[0])); 520 - } 521 - } 522 - 523 - static int percpu_modinit(void) 524 - { 525 - pcpu_num_used = 2; 526 - pcpu_num_allocated = 2; 527 - pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated, 528 - GFP_KERNEL); 529 - /* Static in-kernel percpu data (used). */ 530 - pcpu_size[0] = -(__per_cpu_end-__per_cpu_start); 531 - /* Free room. */ 532 - pcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0]; 533 - if (pcpu_size[1] < 0) { 534 - printk(KERN_ERR "No per-cpu room for modules.\n"); 535 - pcpu_num_used = 1; 536 - } 537 - 538 - return 0; 539 - } 540 - __initcall(percpu_modinit); 541 - 542 - #endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ 543 397 544 398 static unsigned int find_pcpusec(Elf_Ehdr *hdr, 545 399 Elf_Shdr *sechdrs,
+4 -4
kernel/rcutorture.c
··· 763 763 /* Should not happen, but... */ 764 764 pipe_count = RCU_TORTURE_PIPE_LEN; 765 765 } 766 - ++__get_cpu_var(rcu_torture_count)[pipe_count]; 766 + __this_cpu_inc(per_cpu_var(rcu_torture_count)[pipe_count]); 767 767 completed = cur_ops->completed() - completed; 768 768 if (completed > RCU_TORTURE_PIPE_LEN) { 769 769 /* Should not happen, but... */ 770 770 completed = RCU_TORTURE_PIPE_LEN; 771 771 } 772 - ++__get_cpu_var(rcu_torture_batch)[completed]; 772 + __this_cpu_inc(per_cpu_var(rcu_torture_batch)[completed]); 773 773 preempt_enable(); 774 774 cur_ops->readunlock(idx); 775 775 } ··· 818 818 /* Should not happen, but... */ 819 819 pipe_count = RCU_TORTURE_PIPE_LEN; 820 820 } 821 - ++__get_cpu_var(rcu_torture_count)[pipe_count]; 821 + __this_cpu_inc(per_cpu_var(rcu_torture_count)[pipe_count]); 822 822 completed = cur_ops->completed() - completed; 823 823 if (completed > RCU_TORTURE_PIPE_LEN) { 824 824 /* Should not happen, but... */ 825 825 completed = RCU_TORTURE_PIPE_LEN; 826 826 } 827 - ++__get_cpu_var(rcu_torture_batch)[completed]; 827 + __this_cpu_inc(per_cpu_var(rcu_torture_batch)[completed]); 828 828 preempt_enable(); 829 829 cur_ops->readunlock(idx); 830 830 schedule();
+4 -4
kernel/sched.c
··· 298 298 299 299 #ifdef CONFIG_RT_GROUP_SCHED 300 300 static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity); 301 - static DEFINE_PER_CPU_SHARED_ALIGNED(struct rt_rq, init_rt_rq); 301 + static DEFINE_PER_CPU_SHARED_ALIGNED(struct rt_rq, init_rt_rq_var); 302 302 #endif /* CONFIG_RT_GROUP_SCHED */ 303 303 #else /* !CONFIG_USER_SCHED */ 304 304 #define root_task_group init_task_group ··· 8286 8286 */ 8287 8287 #ifdef CONFIG_SCHED_SMT 8288 8288 static DEFINE_PER_CPU(struct static_sched_domain, cpu_domains); 8289 - static DEFINE_PER_CPU(struct static_sched_group, sched_group_cpus); 8289 + static DEFINE_PER_CPU(struct static_sched_group, sched_groups); 8290 8290 8291 8291 static int 8292 8292 cpu_to_cpu_group(int cpu, const struct cpumask *cpu_map, 8293 8293 struct sched_group **sg, struct cpumask *unused) 8294 8294 { 8295 8295 if (sg) 8296 - *sg = &per_cpu(sched_group_cpus, cpu).sg; 8296 + *sg = &per_cpu(sched_groups, cpu).sg; 8297 8297 return cpu; 8298 8298 } 8299 8299 #endif /* CONFIG_SCHED_SMT */ ··· 9583 9583 #elif defined CONFIG_USER_SCHED 9584 9584 init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, 0, NULL); 9585 9585 init_tg_rt_entry(&init_task_group, 9586 - &per_cpu(init_rt_rq, i), 9586 + &per_cpu(init_rt_rq_var, i), 9587 9587 &per_cpu(init_sched_rt_entity, i), i, 1, 9588 9588 root_task_group.rt_se[i]); 9589 9589 #endif
+2 -2
kernel/softirq.c
··· 697 697 open_softirq(HI_SOFTIRQ, tasklet_hi_action); 698 698 } 699 699 700 - static int ksoftirqd(void * __bind_cpu) 700 + static int run_ksoftirqd(void * __bind_cpu) 701 701 { 702 702 set_current_state(TASK_INTERRUPTIBLE); 703 703 ··· 810 810 switch (action) { 811 811 case CPU_UP_PREPARE: 812 812 case CPU_UP_PREPARE_FROZEN: 813 - p = kthread_create(ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu); 813 + p = kthread_create(run_ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu); 814 814 if (IS_ERR(p)) { 815 815 printk("ksoftirqd for %i failed\n", hotcpu); 816 816 return NOTIFY_BAD;
+27 -27
kernel/softlockup.c
··· 22 22 23 23 static DEFINE_SPINLOCK(print_lock); 24 24 25 - static DEFINE_PER_CPU(unsigned long, touch_timestamp); 26 - static DEFINE_PER_CPU(unsigned long, print_timestamp); 27 - static DEFINE_PER_CPU(struct task_struct *, watchdog_task); 25 + static DEFINE_PER_CPU(unsigned long, softlockup_touch_ts); /* touch timestamp */ 26 + static DEFINE_PER_CPU(unsigned long, softlockup_print_ts); /* print timestamp */ 27 + static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); 28 28 29 29 static int __read_mostly did_panic; 30 30 int __read_mostly softlockup_thresh = 60; ··· 70 70 { 71 71 int this_cpu = raw_smp_processor_id(); 72 72 73 - __raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu); 73 + __raw_get_cpu_var(softlockup_touch_ts) = get_timestamp(this_cpu); 74 74 } 75 75 76 76 void touch_softlockup_watchdog(void) 77 77 { 78 - __raw_get_cpu_var(touch_timestamp) = 0; 78 + __raw_get_cpu_var(softlockup_touch_ts) = 0; 79 79 } 80 80 EXPORT_SYMBOL(touch_softlockup_watchdog); 81 81 ··· 85 85 86 86 /* Cause each CPU to re-update its timestamp rather than complain */ 87 87 for_each_online_cpu(cpu) 88 - per_cpu(touch_timestamp, cpu) = 0; 88 + per_cpu(softlockup_touch_ts, cpu) = 0; 89 89 } 90 90 EXPORT_SYMBOL(touch_all_softlockup_watchdogs); 91 91 ··· 104 104 void softlockup_tick(void) 105 105 { 106 106 int this_cpu = smp_processor_id(); 107 - unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu); 108 - unsigned long print_timestamp; 107 + unsigned long touch_ts = per_cpu(softlockup_touch_ts, this_cpu); 108 + unsigned long print_ts; 109 109 struct pt_regs *regs = get_irq_regs(); 110 110 unsigned long now; 111 111 112 112 /* Is detection switched off? */ 113 - if (!per_cpu(watchdog_task, this_cpu) || softlockup_thresh <= 0) { 113 + if (!per_cpu(softlockup_watchdog, this_cpu) || softlockup_thresh <= 0) { 114 114 /* Be sure we don't false trigger if switched back on */ 115 - if (touch_timestamp) 116 - per_cpu(touch_timestamp, this_cpu) = 0; 115 + if (touch_ts) 116 + per_cpu(softlockup_touch_ts, this_cpu) = 0; 117 117 return; 118 118 } 119 119 120 - if (touch_timestamp == 0) { 120 + if (touch_ts == 0) { 121 121 __touch_softlockup_watchdog(); 122 122 return; 123 123 } 124 124 125 - print_timestamp = per_cpu(print_timestamp, this_cpu); 125 + print_ts = per_cpu(softlockup_print_ts, this_cpu); 126 126 127 127 /* report at most once a second */ 128 - if (print_timestamp == touch_timestamp || did_panic) 128 + if (print_ts == touch_ts || did_panic) 129 129 return; 130 130 131 131 /* do not print during early bootup: */ ··· 140 140 * Wake up the high-prio watchdog task twice per 141 141 * threshold timespan. 142 142 */ 143 - if (now > touch_timestamp + softlockup_thresh/2) 144 - wake_up_process(per_cpu(watchdog_task, this_cpu)); 143 + if (now > touch_ts + softlockup_thresh/2) 144 + wake_up_process(per_cpu(softlockup_watchdog, this_cpu)); 145 145 146 146 /* Warn about unreasonable delays: */ 147 - if (now <= (touch_timestamp + softlockup_thresh)) 147 + if (now <= (touch_ts + softlockup_thresh)) 148 148 return; 149 149 150 - per_cpu(print_timestamp, this_cpu) = touch_timestamp; 150 + per_cpu(softlockup_print_ts, this_cpu) = touch_ts; 151 151 152 152 spin_lock(&print_lock); 153 153 printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n", 154 - this_cpu, now - touch_timestamp, 154 + this_cpu, now - touch_ts, 155 155 current->comm, task_pid_nr(current)); 156 156 print_modules(); 157 157 print_irqtrace_events(current); ··· 209 209 switch (action) { 210 210 case CPU_UP_PREPARE: 211 211 case CPU_UP_PREPARE_FROZEN: 212 - BUG_ON(per_cpu(watchdog_task, hotcpu)); 212 + BUG_ON(per_cpu(softlockup_watchdog, hotcpu)); 213 213 p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu); 214 214 if (IS_ERR(p)) { 215 215 printk(KERN_ERR "watchdog for %i failed\n", hotcpu); 216 216 return NOTIFY_BAD; 217 217 } 218 - per_cpu(touch_timestamp, hotcpu) = 0; 219 - per_cpu(watchdog_task, hotcpu) = p; 218 + per_cpu(softlockup_touch_ts, hotcpu) = 0; 219 + per_cpu(softlockup_watchdog, hotcpu) = p; 220 220 kthread_bind(p, hotcpu); 221 221 break; 222 222 case CPU_ONLINE: 223 223 case CPU_ONLINE_FROZEN: 224 - wake_up_process(per_cpu(watchdog_task, hotcpu)); 224 + wake_up_process(per_cpu(softlockup_watchdog, hotcpu)); 225 225 break; 226 226 #ifdef CONFIG_HOTPLUG_CPU 227 227 case CPU_UP_CANCELED: 228 228 case CPU_UP_CANCELED_FROZEN: 229 - if (!per_cpu(watchdog_task, hotcpu)) 229 + if (!per_cpu(softlockup_watchdog, hotcpu)) 230 230 break; 231 231 /* Unbind so it can run. Fall thru. */ 232 - kthread_bind(per_cpu(watchdog_task, hotcpu), 232 + kthread_bind(per_cpu(softlockup_watchdog, hotcpu), 233 233 cpumask_any(cpu_online_mask)); 234 234 case CPU_DEAD: 235 235 case CPU_DEAD_FROZEN: 236 - p = per_cpu(watchdog_task, hotcpu); 237 - per_cpu(watchdog_task, hotcpu) = NULL; 236 + p = per_cpu(softlockup_watchdog, hotcpu); 237 + per_cpu(softlockup_watchdog, hotcpu) = NULL; 238 238 kthread_stop(p); 239 239 break; 240 240 #endif /* CONFIG_HOTPLUG_CPU */
+6 -5
kernel/time/timer_stats.c
··· 86 86 /* 87 87 * Per-CPU lookup locks for fast hash lookup: 88 88 */ 89 - static DEFINE_PER_CPU(spinlock_t, lookup_lock); 89 + static DEFINE_PER_CPU(spinlock_t, tstats_lookup_lock); 90 90 91 91 /* 92 92 * Mutex to serialize state changes with show-stats activities: ··· 245 245 if (likely(!timer_stats_active)) 246 246 return; 247 247 248 - lock = &per_cpu(lookup_lock, raw_smp_processor_id()); 248 + lock = &per_cpu(tstats_lookup_lock, raw_smp_processor_id()); 249 249 250 250 input.timer = timer; 251 251 input.start_func = startf; ··· 348 348 int cpu; 349 349 350 350 for_each_online_cpu(cpu) { 351 - spin_lock_irqsave(&per_cpu(lookup_lock, cpu), flags); 351 + spinlock_t *lock = &per_cpu(tstats_lookup_lock, cpu); 352 + spin_lock_irqsave(lock, flags); 352 353 /* nothing */ 353 - spin_unlock_irqrestore(&per_cpu(lookup_lock, cpu), flags); 354 + spin_unlock_irqrestore(lock, flags); 354 355 } 355 356 } 356 357 ··· 409 408 int cpu; 410 409 411 410 for_each_possible_cpu(cpu) 412 - spin_lock_init(&per_cpu(lookup_lock, cpu)); 411 + spin_lock_init(&per_cpu(tstats_lookup_lock, cpu)); 413 412 } 414 413 415 414 static int __init init_tstats_procfs(void)
+6 -6
kernel/trace/trace.c
··· 86 86 */ 87 87 static int tracing_disabled = 1; 88 88 89 - DEFINE_PER_CPU(local_t, ftrace_cpu_disabled); 89 + DEFINE_PER_CPU(int, ftrace_cpu_disabled); 90 90 91 91 static inline void ftrace_disable_cpu(void) 92 92 { 93 93 preempt_disable(); 94 - local_inc(&__get_cpu_var(ftrace_cpu_disabled)); 94 + __this_cpu_inc(per_cpu_var(ftrace_cpu_disabled)); 95 95 } 96 96 97 97 static inline void ftrace_enable_cpu(void) 98 98 { 99 - local_dec(&__get_cpu_var(ftrace_cpu_disabled)); 99 + __this_cpu_dec(per_cpu_var(ftrace_cpu_disabled)); 100 100 preempt_enable(); 101 101 } 102 102 ··· 203 203 */ 204 204 static struct trace_array max_tr; 205 205 206 - static DEFINE_PER_CPU(struct trace_array_cpu, max_data); 206 + static DEFINE_PER_CPU(struct trace_array_cpu, max_tr_data); 207 207 208 208 /* tracer_enabled is used to toggle activation of a tracer */ 209 209 static int tracer_enabled = 1; ··· 1085 1085 struct ftrace_entry *entry; 1086 1086 1087 1087 /* If we are reading the ring buffer, don't trace */ 1088 - if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) 1088 + if (unlikely(__this_cpu_read(per_cpu_var(ftrace_cpu_disabled)))) 1089 1089 return; 1090 1090 1091 1091 event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry), ··· 4454 4454 /* Allocate the first page for all buffers */ 4455 4455 for_each_tracing_cpu(i) { 4456 4456 global_trace.data[i] = &per_cpu(global_trace_cpu, i); 4457 - max_tr.data[i] = &per_cpu(max_data, i); 4457 + max_tr.data[i] = &per_cpu(max_tr_data, i); 4458 4458 } 4459 4459 4460 4460 trace_init_cmdlines();
+1 -1
kernel/trace/trace.h
··· 443 443 444 444 extern int ring_buffer_expanded; 445 445 extern bool tracing_selftest_disabled; 446 - DECLARE_PER_CPU(local_t, ftrace_cpu_disabled); 446 + DECLARE_PER_CPU(int, ftrace_cpu_disabled); 447 447 448 448 #ifdef CONFIG_FTRACE_STARTUP_TEST 449 449 extern int trace_selftest_startup_function(struct tracer *trace,
+2 -2
kernel/trace/trace_functions_graph.c
··· 187 187 struct ring_buffer *buffer = tr->buffer; 188 188 struct ftrace_graph_ent_entry *entry; 189 189 190 - if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) 190 + if (unlikely(__this_cpu_read(per_cpu_var(ftrace_cpu_disabled)))) 191 191 return 0; 192 192 193 193 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_ENT, ··· 251 251 struct ring_buffer *buffer = tr->buffer; 252 252 struct ftrace_graph_ret_entry *entry; 253 253 254 - if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) 254 + if (unlikely(__this_cpu_read(per_cpu_var(ftrace_cpu_disabled)))) 255 255 return; 256 256 257 257 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_RET,
+26 -25
kernel/trace/trace_hw_branches.c
··· 20 20 21 21 #define BTS_BUFFER_SIZE (1 << 13) 22 22 23 - static DEFINE_PER_CPU(struct bts_tracer *, tracer); 24 - static DEFINE_PER_CPU(unsigned char[BTS_BUFFER_SIZE], buffer); 23 + static DEFINE_PER_CPU(struct bts_tracer *, hwb_tracer); 24 + static DEFINE_PER_CPU(unsigned char[BTS_BUFFER_SIZE], hwb_buffer); 25 25 26 - #define this_tracer per_cpu(tracer, smp_processor_id()) 26 + #define this_tracer per_cpu(hwb_tracer, smp_processor_id()) 27 27 28 28 static int trace_hw_branches_enabled __read_mostly; 29 29 static int trace_hw_branches_suspended __read_mostly; ··· 32 32 33 33 static void bts_trace_init_cpu(int cpu) 34 34 { 35 - per_cpu(tracer, cpu) = 36 - ds_request_bts_cpu(cpu, per_cpu(buffer, cpu), BTS_BUFFER_SIZE, 37 - NULL, (size_t)-1, BTS_KERNEL); 35 + per_cpu(hwb_tracer, cpu) = 36 + ds_request_bts_cpu(cpu, per_cpu(hwb_buffer, cpu), 37 + BTS_BUFFER_SIZE, NULL, (size_t)-1, 38 + BTS_KERNEL); 38 39 39 - if (IS_ERR(per_cpu(tracer, cpu))) 40 - per_cpu(tracer, cpu) = NULL; 40 + if (IS_ERR(per_cpu(hwb_tracer, cpu))) 41 + per_cpu(hwb_tracer, cpu) = NULL; 41 42 } 42 43 43 44 static int bts_trace_init(struct trace_array *tr) ··· 52 51 for_each_online_cpu(cpu) { 53 52 bts_trace_init_cpu(cpu); 54 53 55 - if (likely(per_cpu(tracer, cpu))) 54 + if (likely(per_cpu(hwb_tracer, cpu))) 56 55 trace_hw_branches_enabled = 1; 57 56 } 58 57 trace_hw_branches_suspended = 0; ··· 68 67 69 68 get_online_cpus(); 70 69 for_each_online_cpu(cpu) { 71 - if (likely(per_cpu(tracer, cpu))) { 72 - ds_release_bts(per_cpu(tracer, cpu)); 73 - per_cpu(tracer, cpu) = NULL; 70 + if (likely(per_cpu(hwb_tracer, cpu))) { 71 + ds_release_bts(per_cpu(hwb_tracer, cpu)); 72 + per_cpu(hwb_tracer, cpu) = NULL; 74 73 } 75 74 } 76 75 trace_hw_branches_enabled = 0; ··· 84 83 85 84 get_online_cpus(); 86 85 for_each_online_cpu(cpu) 87 - if (likely(per_cpu(tracer, cpu))) 88 - ds_resume_bts(per_cpu(tracer, cpu)); 86 + if (likely(per_cpu(hwb_tracer, cpu))) 87 + ds_resume_bts(per_cpu(hwb_tracer, cpu)); 89 88 trace_hw_branches_suspended = 0; 90 89 put_online_cpus(); 91 90 } ··· 96 95 97 96 get_online_cpus(); 98 97 for_each_online_cpu(cpu) 99 - if (likely(per_cpu(tracer, cpu))) 100 - ds_suspend_bts(per_cpu(tracer, cpu)); 98 + if (likely(per_cpu(hwb_tracer, cpu))) 99 + ds_suspend_bts(per_cpu(hwb_tracer, cpu)); 101 100 trace_hw_branches_suspended = 1; 102 101 put_online_cpus(); 103 102 } ··· 115 114 bts_trace_init_cpu(cpu); 116 115 117 116 if (trace_hw_branches_suspended && 118 - likely(per_cpu(tracer, cpu))) 119 - ds_suspend_bts(per_cpu(tracer, cpu)); 117 + likely(per_cpu(hwb_tracer, cpu))) 118 + ds_suspend_bts(per_cpu(hwb_tracer, cpu)); 120 119 } 121 120 break; 122 121 123 122 case CPU_DOWN_PREPARE: 124 123 /* The notification is sent with interrupts enabled. */ 125 - if (likely(per_cpu(tracer, cpu))) { 126 - ds_release_bts(per_cpu(tracer, cpu)); 127 - per_cpu(tracer, cpu) = NULL; 124 + if (likely(per_cpu(hwb_tracer, cpu))) { 125 + ds_release_bts(per_cpu(hwb_tracer, cpu)); 126 + per_cpu(hwb_tracer, cpu) = NULL; 128 127 } 129 128 } 130 129 ··· 259 258 260 259 get_online_cpus(); 261 260 for_each_online_cpu(cpu) 262 - if (likely(per_cpu(tracer, cpu))) 263 - ds_suspend_bts(per_cpu(tracer, cpu)); 261 + if (likely(per_cpu(hwb_tracer, cpu))) 262 + ds_suspend_bts(per_cpu(hwb_tracer, cpu)); 264 263 /* 265 264 * We need to collect the trace on the respective cpu since ftrace 266 265 * implicitly adds the record for the current cpu. ··· 269 268 on_each_cpu(trace_bts_cpu, iter->tr, 1); 270 269 271 270 for_each_online_cpu(cpu) 272 - if (likely(per_cpu(tracer, cpu))) 273 - ds_resume_bts(per_cpu(tracer, cpu)); 271 + if (likely(per_cpu(hwb_tracer, cpu))) 272 + ds_resume_bts(per_cpu(hwb_tracer, cpu)); 274 273 put_online_cpus(); 275 274 } 276 275
-4
mm/Makefile
··· 34 34 obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o 35 35 obj-$(CONFIG_FS_XIP) += filemap_xip.o 36 36 obj-$(CONFIG_MIGRATION) += migrate.o 37 - ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA 38 37 obj-$(CONFIG_SMP) += percpu.o 39 - else 40 - obj-$(CONFIG_SMP) += allocpercpu.o 41 - endif 42 38 obj-$(CONFIG_QUICKLIST) += quicklist.o 43 39 obj-$(CONFIG_CGROUP_MEM_RES_CTLR) += memcontrol.o page_cgroup.o 44 40 obj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o
-177
mm/allocpercpu.c
··· 1 - /* 2 - * linux/mm/allocpercpu.c 3 - * 4 - * Separated from slab.c August 11, 2006 Christoph Lameter 5 - */ 6 - #include <linux/mm.h> 7 - #include <linux/module.h> 8 - #include <linux/bootmem.h> 9 - #include <asm/sections.h> 10 - 11 - #ifndef cache_line_size 12 - #define cache_line_size() L1_CACHE_BYTES 13 - #endif 14 - 15 - /** 16 - * percpu_depopulate - depopulate per-cpu data for given cpu 17 - * @__pdata: per-cpu data to depopulate 18 - * @cpu: depopulate per-cpu data for this cpu 19 - * 20 - * Depopulating per-cpu data for a cpu going offline would be a typical 21 - * use case. You need to register a cpu hotplug handler for that purpose. 22 - */ 23 - static void percpu_depopulate(void *__pdata, int cpu) 24 - { 25 - struct percpu_data *pdata = __percpu_disguise(__pdata); 26 - 27 - kfree(pdata->ptrs[cpu]); 28 - pdata->ptrs[cpu] = NULL; 29 - } 30 - 31 - /** 32 - * percpu_depopulate_mask - depopulate per-cpu data for some cpu's 33 - * @__pdata: per-cpu data to depopulate 34 - * @mask: depopulate per-cpu data for cpu's selected through mask bits 35 - */ 36 - static void __percpu_depopulate_mask(void *__pdata, const cpumask_t *mask) 37 - { 38 - int cpu; 39 - for_each_cpu_mask_nr(cpu, *mask) 40 - percpu_depopulate(__pdata, cpu); 41 - } 42 - 43 - #define percpu_depopulate_mask(__pdata, mask) \ 44 - __percpu_depopulate_mask((__pdata), &(mask)) 45 - 46 - /** 47 - * percpu_populate - populate per-cpu data for given cpu 48 - * @__pdata: per-cpu data to populate further 49 - * @size: size of per-cpu object 50 - * @gfp: may sleep or not etc. 51 - * @cpu: populate per-data for this cpu 52 - * 53 - * Populating per-cpu data for a cpu coming online would be a typical 54 - * use case. You need to register a cpu hotplug handler for that purpose. 55 - * Per-cpu object is populated with zeroed buffer. 56 - */ 57 - static void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) 58 - { 59 - struct percpu_data *pdata = __percpu_disguise(__pdata); 60 - int node = cpu_to_node(cpu); 61 - 62 - /* 63 - * We should make sure each CPU gets private memory. 64 - */ 65 - size = roundup(size, cache_line_size()); 66 - 67 - BUG_ON(pdata->ptrs[cpu]); 68 - if (node_online(node)) 69 - pdata->ptrs[cpu] = kmalloc_node(size, gfp|__GFP_ZERO, node); 70 - else 71 - pdata->ptrs[cpu] = kzalloc(size, gfp); 72 - return pdata->ptrs[cpu]; 73 - } 74 - 75 - /** 76 - * percpu_populate_mask - populate per-cpu data for more cpu's 77 - * @__pdata: per-cpu data to populate further 78 - * @size: size of per-cpu object 79 - * @gfp: may sleep or not etc. 80 - * @mask: populate per-cpu data for cpu's selected through mask bits 81 - * 82 - * Per-cpu objects are populated with zeroed buffers. 83 - */ 84 - static int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, 85 - cpumask_t *mask) 86 - { 87 - cpumask_t populated; 88 - int cpu; 89 - 90 - cpus_clear(populated); 91 - for_each_cpu_mask_nr(cpu, *mask) 92 - if (unlikely(!percpu_populate(__pdata, size, gfp, cpu))) { 93 - __percpu_depopulate_mask(__pdata, &populated); 94 - return -ENOMEM; 95 - } else 96 - cpu_set(cpu, populated); 97 - return 0; 98 - } 99 - 100 - #define percpu_populate_mask(__pdata, size, gfp, mask) \ 101 - __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) 102 - 103 - /** 104 - * alloc_percpu - initial setup of per-cpu data 105 - * @size: size of per-cpu object 106 - * @align: alignment 107 - * 108 - * Allocate dynamic percpu area. Percpu objects are populated with 109 - * zeroed buffers. 110 - */ 111 - void *__alloc_percpu(size_t size, size_t align) 112 - { 113 - /* 114 - * We allocate whole cache lines to avoid false sharing 115 - */ 116 - size_t sz = roundup(nr_cpu_ids * sizeof(void *), cache_line_size()); 117 - void *pdata = kzalloc(sz, GFP_KERNEL); 118 - void *__pdata = __percpu_disguise(pdata); 119 - 120 - /* 121 - * Can't easily make larger alignment work with kmalloc. WARN 122 - * on it. Larger alignment should only be used for module 123 - * percpu sections on SMP for which this path isn't used. 124 - */ 125 - WARN_ON_ONCE(align > SMP_CACHE_BYTES); 126 - 127 - if (unlikely(!pdata)) 128 - return NULL; 129 - if (likely(!__percpu_populate_mask(__pdata, size, GFP_KERNEL, 130 - &cpu_possible_map))) 131 - return __pdata; 132 - kfree(pdata); 133 - return NULL; 134 - } 135 - EXPORT_SYMBOL_GPL(__alloc_percpu); 136 - 137 - /** 138 - * free_percpu - final cleanup of per-cpu data 139 - * @__pdata: object to clean up 140 - * 141 - * We simply clean up any per-cpu object left. No need for the client to 142 - * track and specify through a bis mask which per-cpu objects are to free. 143 - */ 144 - void free_percpu(void *__pdata) 145 - { 146 - if (unlikely(!__pdata)) 147 - return; 148 - __percpu_depopulate_mask(__pdata, cpu_possible_mask); 149 - kfree(__percpu_disguise(__pdata)); 150 - } 151 - EXPORT_SYMBOL_GPL(free_percpu); 152 - 153 - /* 154 - * Generic percpu area setup. 155 - */ 156 - #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 157 - unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; 158 - 159 - EXPORT_SYMBOL(__per_cpu_offset); 160 - 161 - void __init setup_per_cpu_areas(void) 162 - { 163 - unsigned long size, i; 164 - char *ptr; 165 - unsigned long nr_possible_cpus = num_possible_cpus(); 166 - 167 - /* Copy section for each CPU (we discard the original) */ 168 - size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE); 169 - ptr = alloc_bootmem_pages(size * nr_possible_cpus); 170 - 171 - for_each_possible_cpu(i) { 172 - __per_cpu_offset[i] = ptr - __per_cpu_start; 173 - memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 174 - ptr += size; 175 - } 176 - } 177 - #endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
+22 -2
mm/percpu.c
··· 46 46 * 47 47 * To use this allocator, arch code should do the followings. 48 48 * 49 - * - drop CONFIG_HAVE_LEGACY_PER_CPU_AREA 50 - * 51 49 * - define __addr_to_pcpu_ptr() and __pcpu_ptr_to_addr() to translate 52 50 * regular address to percpu pointer and back if they need to be 53 51 * different from the default ··· 72 74 #include <asm/cacheflush.h> 73 75 #include <asm/sections.h> 74 76 #include <asm/tlbflush.h> 77 + #include <asm/io.h> 75 78 76 79 #define PCPU_SLOT_BASE_SHIFT 5 /* 1-31 shares the same slot */ 77 80 #define PCPU_DFL_MAP_ALLOC 16 /* start a map with 16 ents */ ··· 1300 1301 spin_unlock_irqrestore(&pcpu_lock, flags); 1301 1302 } 1302 1303 EXPORT_SYMBOL_GPL(free_percpu); 1304 + 1305 + /** 1306 + * per_cpu_ptr_to_phys - convert translated percpu address to physical address 1307 + * @addr: the address to be converted to physical address 1308 + * 1309 + * Given @addr which is dereferenceable address obtained via one of 1310 + * percpu access macros, this function translates it into its physical 1311 + * address. The caller is responsible for ensuring @addr stays valid 1312 + * until this function finishes. 1313 + * 1314 + * RETURNS: 1315 + * The physical address for @addr. 1316 + */ 1317 + phys_addr_t per_cpu_ptr_to_phys(void *addr) 1318 + { 1319 + if ((unsigned long)addr < VMALLOC_START || 1320 + (unsigned long)addr >= VMALLOC_END) 1321 + return __pa(addr); 1322 + else 1323 + return page_to_phys(vmalloc_to_page(addr)); 1324 + } 1303 1325 1304 1326 static inline size_t pcpu_calc_fc_sizes(size_t static_size, 1305 1327 size_t reserved_size,
+9 -9
mm/slab.c
··· 697 697 static DEFINE_MUTEX(cache_chain_mutex); 698 698 static struct list_head cache_chain; 699 699 700 - static DEFINE_PER_CPU(struct delayed_work, reap_work); 700 + static DEFINE_PER_CPU(struct delayed_work, slab_reap_work); 701 701 702 702 static inline struct array_cache *cpu_cache_get(struct kmem_cache *cachep) 703 703 { ··· 838 838 * objects freed on different nodes from which they were allocated) and the 839 839 * flushing of remote pcps by calling drain_node_pages. 840 840 */ 841 - static DEFINE_PER_CPU(unsigned long, reap_node); 841 + static DEFINE_PER_CPU(unsigned long, slab_reap_node); 842 842 843 843 static void init_reap_node(int cpu) 844 844 { ··· 848 848 if (node == MAX_NUMNODES) 849 849 node = first_node(node_online_map); 850 850 851 - per_cpu(reap_node, cpu) = node; 851 + per_cpu(slab_reap_node, cpu) = node; 852 852 } 853 853 854 854 static void next_reap_node(void) 855 855 { 856 - int node = __get_cpu_var(reap_node); 856 + int node = __get_cpu_var(slab_reap_node); 857 857 858 858 node = next_node(node, node_online_map); 859 859 if (unlikely(node >= MAX_NUMNODES)) 860 860 node = first_node(node_online_map); 861 - __get_cpu_var(reap_node) = node; 861 + __get_cpu_var(slab_reap_node) = node; 862 862 } 863 863 864 864 #else ··· 875 875 */ 876 876 static void __cpuinit start_cpu_timer(int cpu) 877 877 { 878 - struct delayed_work *reap_work = &per_cpu(reap_work, cpu); 878 + struct delayed_work *reap_work = &per_cpu(slab_reap_work, cpu); 879 879 880 880 /* 881 881 * When this gets called from do_initcalls via cpucache_init(), ··· 1039 1039 */ 1040 1040 static void reap_alien(struct kmem_cache *cachep, struct kmem_list3 *l3) 1041 1041 { 1042 - int node = __get_cpu_var(reap_node); 1042 + int node = __get_cpu_var(slab_reap_node); 1043 1043 1044 1044 if (l3->alien) { 1045 1045 struct array_cache *ac = l3->alien[node]; ··· 1300 1300 * anything expensive but will only modify reap_work 1301 1301 * and reschedule the timer. 1302 1302 */ 1303 - cancel_rearming_delayed_work(&per_cpu(reap_work, cpu)); 1303 + cancel_rearming_delayed_work(&per_cpu(slab_reap_work, cpu)); 1304 1304 /* Now the cache_reaper is guaranteed to be not running. */ 1305 - per_cpu(reap_work, cpu).work.func = NULL; 1305 + per_cpu(slab_reap_work, cpu).work.func = NULL; 1306 1306 break; 1307 1307 case CPU_DOWN_FAILED: 1308 1308 case CPU_DOWN_FAILED_FROZEN:
+2 -2
mm/vmalloc.c
··· 761 761 spin_lock(&vbq->lock); 762 762 list_add(&vb->free_list, &vbq->free); 763 763 spin_unlock(&vbq->lock); 764 - put_cpu_var(vmap_cpu_blocks); 764 + put_cpu_var(vmap_block_queue); 765 765 766 766 return vb; 767 767 } ··· 826 826 } 827 827 spin_unlock(&vb->lock); 828 828 } 829 - put_cpu_var(vmap_cpu_blocks); 829 + put_cpu_var(vmap_block_queue); 830 830 rcu_read_unlock(); 831 831 832 832 if (!addr) {
+3 -4
mm/vmstat.c
··· 883 883 884 884 static void __cpuinit start_cpu_timer(int cpu) 885 885 { 886 - struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu); 886 + struct delayed_work *work = &per_cpu(vmstat_work, cpu); 887 887 888 - INIT_DELAYED_WORK_DEFERRABLE(vmstat_work, vmstat_update); 889 - schedule_delayed_work_on(cpu, vmstat_work, 890 - __round_jiffies_relative(HZ, cpu)); 888 + INIT_DELAYED_WORK_DEFERRABLE(work, vmstat_update); 889 + schedule_delayed_work_on(cpu, work, __round_jiffies_relative(HZ, cpu)); 891 890 } 892 891 893 892 /*