[PARISC] Add __read_mostly section for parisc

Flag a whole bunch of things as __read_mostly on parisc. Also flag a few
branches as unlikely() and cleanup a bit of code.

Signed-off-by: Helge Deller <deller@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

authored by

Helge Deller and committed by
Kyle McMartin
8039de10 02706647

+79 -73
+6 -6
arch/parisc/kernel/cache.c
··· 29 29 #include <asm/processor.h> 30 30 #include <asm/sections.h> 31 31 32 - int split_tlb; 33 - int dcache_stride; 34 - int icache_stride; 32 + int split_tlb __read_mostly; 33 + int dcache_stride __read_mostly; 34 + int icache_stride __read_mostly; 35 35 EXPORT_SYMBOL(dcache_stride); 36 36 37 37 ··· 45 45 EXPORT_SYMBOL(pa_tlb_lock); 46 46 #endif 47 47 48 - struct pdc_cache_info cache_info; 48 + struct pdc_cache_info cache_info __read_mostly; 49 49 #ifndef CONFIG_PA20 50 - static struct pdc_btlb_info btlb_info; 50 + static struct pdc_btlb_info btlb_info __read_mostly; 51 51 #endif 52 52 53 53 #ifdef CONFIG_SMP ··· 332 332 } 333 333 334 334 #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ 335 - int parisc_cache_flush_threshold = FLUSH_THRESHOLD; 335 + int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; 336 336 337 337 void parisc_setup_cache_timing(void) 338 338 {
+1 -1
arch/parisc/kernel/drivers.c
··· 39 39 #include <asm/parisc-device.h> 40 40 41 41 /* See comments in include/asm-parisc/pci.h */ 42 - struct hppa_dma_ops *hppa_dma_ops; 42 + struct hppa_dma_ops *hppa_dma_ops __read_mostly; 43 43 EXPORT_SYMBOL(hppa_dma_ops); 44 44 45 45 static struct device root = {
+1 -1
arch/parisc/kernel/firmware.c
··· 80 80 81 81 /* Firmware needs to be initially set to narrow to determine the 82 82 * actual firmware width. */ 83 - int parisc_narrow_firmware = 1; 83 + int parisc_narrow_firmware __read_mostly = 1; 84 84 #endif 85 85 86 86 /* On most currently-supported platforms, IODC I/O calls are 32-bit calls
+3 -3
arch/parisc/kernel/inventory.c
··· 38 38 */ 39 39 #undef DEBUG_PAT 40 40 41 - int pdc_type = PDC_TYPE_ILLEGAL; 41 + int pdc_type __read_mostly = PDC_TYPE_ILLEGAL; 42 42 43 43 void __init setup_pdc(void) 44 44 { ··· 120 120 * pdc info is bad in this case). 121 121 */ 122 122 123 - if ( ((start & (PAGE_SIZE - 1)) != 0) 124 - || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) ) { 123 + if (unlikely( ((start & (PAGE_SIZE - 1)) != 0) 124 + || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) { 125 125 126 126 panic("Memory range doesn't align with page size!\n"); 127 127 }
+3 -3
arch/parisc/kernel/pci-dma.c
··· 33 33 #include <asm/uaccess.h> 34 34 #include <asm/tlbflush.h> /* for purge_tlb_*() macros */ 35 35 36 - static struct proc_dir_entry * proc_gsc_root = NULL; 36 + static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; 37 37 static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); 38 - static unsigned long pcxl_used_bytes = 0; 39 - static unsigned long pcxl_used_pages = 0; 38 + static unsigned long pcxl_used_bytes __read_mostly = 0; 39 + static unsigned long pcxl_used_pages __read_mostly = 0; 40 40 41 41 extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */ 42 42 static spinlock_t pcxl_res_lock;
+7 -6
arch/parisc/kernel/pdc_chassis.c
··· 30 30 #include <linux/kernel.h> 31 31 #include <linux/reboot.h> 32 32 #include <linux/notifier.h> 33 + #include <linux/cache.h> 33 34 34 35 #include <asm/pdc_chassis.h> 35 36 #include <asm/processor.h> ··· 39 38 40 39 41 40 #ifdef CONFIG_PDC_CHASSIS 42 - static int pdc_chassis_old = 0; 43 - static unsigned int pdc_chassis_enabled = 1; 41 + static int pdc_chassis_old __read_mostly = 0; 42 + static unsigned int pdc_chassis_enabled __read_mostly = 1; 44 43 45 44 46 45 /** ··· 133 132 { 134 133 #ifdef CONFIG_PDC_CHASSIS 135 134 int handle = 0; 136 - if (pdc_chassis_enabled) { 135 + if (likely(pdc_chassis_enabled)) { 137 136 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__); 138 137 139 138 /* Let see if we have something to handle... */ ··· 143 142 printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n"); 144 143 handle = 1; 145 144 } 146 - else if (pdc_chassis_old) { 145 + else if (unlikely(pdc_chassis_old)) { 147 146 printk(KERN_INFO "Enabling old style chassis LED panel support.\n"); 148 147 handle = 1; 149 148 } ··· 179 178 /* Maybe we should do that in an other way ? */ 180 179 int retval = 0; 181 180 #ifdef CONFIG_PDC_CHASSIS 182 - if (pdc_chassis_enabled) { 181 + if (likely(pdc_chassis_enabled)) { 183 182 184 183 DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message); 185 184 ··· 215 214 } 216 215 } else retval = -1; 217 216 #else 218 - if (pdc_chassis_old) { 217 + if (unlikely(pdc_chassis_old)) { 219 218 switch (message) { 220 219 case PDC_CHASSIS_DIRECT_BSTART: 221 220 case PDC_CHASSIS_DIRECT_BCOMPLETE:
+3 -3
arch/parisc/kernel/perf.c
··· 66 66 uint8_t write_control; 67 67 }; 68 68 69 - static int perf_processor_interface = UNKNOWN_INTF; 70 - static int perf_enabled = 0; 69 + static int perf_processor_interface __read_mostly = UNKNOWN_INTF; 70 + static int perf_enabled __read_mostly = 0; 71 71 static spinlock_t perf_lock; 72 - struct parisc_device *cpu_device = NULL; 72 + struct parisc_device *cpu_device __read_mostly = NULL; 73 73 74 74 /* RDRs to write for PCX-W */ 75 75 static int perf_rdrs_W[] =
+1 -1
arch/parisc/kernel/process.c
··· 54 54 #include <asm/uaccess.h> 55 55 #include <asm/unwind.h> 56 56 57 - static int hlt_counter; 57 + static int hlt_counter __read_mostly; 58 58 59 59 /* 60 60 * Power off function, if any
+4 -4
arch/parisc/kernel/processor.c
··· 44 44 #include <asm/irq.h> /* for struct irq_region */ 45 45 #include <asm/parisc-device.h> 46 46 47 - struct system_cpuinfo_parisc boot_cpu_data; 47 + struct system_cpuinfo_parisc boot_cpu_data __read_mostly; 48 48 EXPORT_SYMBOL(boot_cpu_data); 49 49 50 - struct cpuinfo_parisc cpu_data[NR_CPUS]; 50 + struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly; 51 51 52 52 /* 53 53 ** PARISC CPU driver - claim "device" and initialize CPU data structures. ··· 378 378 return 0; 379 379 } 380 380 381 - static struct parisc_device_id processor_tbl[] = { 381 + static struct parisc_device_id processor_tbl[] __read_mostly = { 382 382 { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID }, 383 383 { 0, } 384 384 }; 385 385 386 - static struct parisc_driver cpu_driver = { 386 + static struct parisc_driver cpu_driver __read_mostly = { 387 387 .name = "CPU", 388 388 .id_table = processor_tbl, 389 389 .probe = processor_probe
+5 -5
arch/parisc/kernel/setup.c
··· 46 46 #include <asm/io.h> 47 47 #include <asm/setup.h> 48 48 49 - char command_line[COMMAND_LINE_SIZE]; 49 + char command_line[COMMAND_LINE_SIZE] __read_mostly; 50 50 51 51 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ 52 - struct proc_dir_entry * proc_runway_root = NULL; 53 - struct proc_dir_entry * proc_gsc_root = NULL; 54 - struct proc_dir_entry * proc_mckinley_root = NULL; 52 + struct proc_dir_entry * proc_runway_root __read_mostly = NULL; 53 + struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; 54 + struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL; 55 55 56 56 #if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)) 57 - int parisc_bus_is_phys = 1; /* Assume no IOMMU is present */ 57 + int parisc_bus_is_phys __read_mostly = 1; /* Assume no IOMMU is present */ 58 58 EXPORT_SYMBOL(parisc_bus_is_phys); 59 59 #endif 60 60
+4 -4
arch/parisc/kernel/smp.c
··· 58 58 59 59 volatile struct task_struct *smp_init_current_idle_task; 60 60 61 - static volatile int cpu_now_booting = 0; /* track which CPU is booting */ 61 + static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is booting */ 62 62 63 - static int parisc_max_cpus = 1; 63 + static int parisc_max_cpus __read_mostly = 1; 64 64 65 65 /* online cpus are ones that we've managed to bring up completely 66 66 * possible cpus are all valid cpu ··· 71 71 * empty in the beginning. 72 72 */ 73 73 74 - cpumask_t cpu_online_map = CPU_MASK_NONE; /* Bitmap of online CPUs */ 75 - cpumask_t cpu_possible_map = CPU_MASK_ALL; /* Bitmap of Present CPUs */ 74 + cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */ 75 + cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */ 76 76 77 77 EXPORT_SYMBOL(cpu_online_map); 78 78 EXPORT_SYMBOL(cpu_possible_map);
+2 -2
arch/parisc/kernel/time.c
··· 36 36 /* xtime and wall_jiffies keep wall-clock time */ 37 37 extern unsigned long wall_jiffies; 38 38 39 - static long clocktick; /* timer cycles per tick */ 40 - static long halftick; 39 + static long clocktick __read_mostly; /* timer cycles per tick */ 40 + static long halftick __read_mostly; 41 41 42 42 #ifdef CONFIG_SMP 43 43 extern void smp_do_timer(struct pt_regs *regs);
+2 -1
arch/parisc/kernel/topology.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/smp.h> 22 22 #include <linux/cpu.h> 23 + #include <linux/cache.h> 23 24 24 - static struct cpu cpu_devices[NR_CPUS]; 25 + static struct cpu cpu_devices[NR_CPUS] __read_mostly; 25 26 26 27 static int __init topology_init(void) 27 28 {
+1 -1
arch/parisc/kernel/unaligned.c
··· 122 122 #define ERR_NOTHANDLED -1 123 123 #define ERR_PAGEFAULT -2 124 124 125 - int unaligned_enabled = 1; 125 + int unaligned_enabled __read_mostly = 1; 126 126 127 127 void die_if_kernel (char *str, struct pt_regs *regs, long err); 128 128
+1 -1
arch/parisc/kernel/unwind.c
··· 35 35 * we can call unwind_init as early in the bootup process as 36 36 * possible (before the slab allocator is initialized) 37 37 */ 38 - static struct unwind_table kernel_unwind_table; 38 + static struct unwind_table kernel_unwind_table __read_mostly; 39 39 static LIST_HEAD(unwind_tables); 40 40 41 41 static inline const struct unwind_table_entry *
+4
arch/parisc/kernel/vmlinux.lds.S
··· 105 105 . = ALIGN(16); 106 106 .data.lock_aligned : { *(.data.lock_aligned) } 107 107 108 + /* rarely changed data like cpu maps */ 109 + . = ALIGN(16); 110 + .data.read_mostly : { *(.data.read_mostly) } 111 + 108 112 _edata = .; /* End of data section */ 109 113 110 114 . = ALIGN(16384); /* init_task */
+10 -10
arch/parisc/mm/init.c
··· 36 36 extern char __init_begin, __init_end; 37 37 38 38 #ifdef CONFIG_DISCONTIGMEM 39 - struct node_map_data node_data[MAX_NUMNODES]; 40 - bootmem_data_t bmem_data[MAX_NUMNODES]; 41 - unsigned char pfnnid_map[PFNNID_MAP_MAX]; 39 + struct node_map_data node_data[MAX_NUMNODES] __read_mostly; 40 + bootmem_data_t bmem_data[MAX_NUMNODES] __read_mostly; 41 + unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; 42 42 #endif 43 43 44 44 static struct resource data_resource = { ··· 58 58 .flags = IORESOURCE_BUSY | IORESOURCE_MEM, 59 59 }; 60 60 61 - static struct resource sysram_resources[MAX_PHYSMEM_RANGES]; 61 + static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly; 62 62 63 63 /* The following array is initialized from the firmware specific 64 64 * information retrieved in kernel/inventory.c. 65 65 */ 66 66 67 - physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES]; 68 - int npmem_ranges; 67 + physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; 68 + int npmem_ranges __read_mostly; 69 69 70 70 #ifdef __LP64__ 71 71 #define MAX_MEM (~0UL) ··· 73 73 #define MAX_MEM (3584U*1024U*1024U) 74 74 #endif /* !__LP64__ */ 75 75 76 - static unsigned long mem_limit = MAX_MEM; 76 + static unsigned long mem_limit __read_mostly = MAX_MEM; 77 77 78 78 static void __init mem_limit_func(void) 79 79 { ··· 431 431 #define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \ 432 432 & ~(VM_MAP_OFFSET-1))) 433 433 434 - void *vmalloc_start; 434 + void *vmalloc_start __read_mostly; 435 435 EXPORT_SYMBOL(vmalloc_start); 436 436 437 437 #ifdef CONFIG_PA11 438 - unsigned long pcxl_dma_start; 438 + unsigned long pcxl_dma_start __read_mostly; 439 439 #endif 440 440 441 441 void __init mem_init(void) ··· 475 475 return 0; 476 476 } 477 477 478 - unsigned long *empty_zero_page; 478 + unsigned long *empty_zero_page __read_mostly; 479 479 480 480 void show_mem(void) 481 481 {
+2 -2
drivers/parisc/eisa.c
··· 57 57 58 58 static DEFINE_SPINLOCK(eisa_irq_lock); 59 59 60 - void __iomem *eisa_eeprom_addr; 60 + void __iomem *eisa_eeprom_addr __read_mostly; 61 61 62 62 /* We can only have one EISA adapter in the system because neither 63 63 * implementation can be flexed. ··· 141 141 * in the furure. 142 142 */ 143 143 /* irq 13,8,2,1,0 must be edge */ 144 - static unsigned int eisa_irq_level; /* default to edge triggered */ 144 + static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered */ 145 145 146 146 147 147 /* called by free irq */
+1 -1
drivers/parisc/lasi.c
··· 150 150 * 151 151 */ 152 152 153 - static unsigned long lasi_power_off_hpa; 153 + static unsigned long lasi_power_off_hpa __read_mostly; 154 154 155 155 static void lasi_power_off(void) 156 156 {
+1 -1
drivers/parisc/lba_pci.c
··· 167 167 168 168 /* non-postable I/O port space, densely packed */ 169 169 #define LBA_PORT_BASE (PCI_F_EXTEND | 0xfee00000UL) 170 - static void __iomem *astro_iop_base; 170 + static void __iomem *astro_iop_base __read_mostly; 171 171 172 172 #define ELROY_HVERS 0x782 173 173 #define MERCURY_HVERS 0x783
+9 -9
drivers/parisc/led.c
··· 3 3 * 4 4 * (c) Copyright 2000 Red Hat Software 5 5 * (c) Copyright 2000 Helge Deller <hdeller@redhat.com> 6 - * (c) Copyright 2001-2004 Helge Deller <deller@gmx.de> 6 + * (c) Copyright 2001-2005 Helge Deller <deller@gmx.de> 7 7 * (c) Copyright 2001 Randolph Chung <tausq@debian.org> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify ··· 56 56 relatively large amount of CPU time, some of the calculations can be 57 57 turned off with the following variables (controlled via procfs) */ 58 58 59 - static int led_type = -1; 59 + static int led_type __read_mostly = -1; 60 60 static unsigned char lastleds; /* LED state from most recent update */ 61 - static unsigned int led_heartbeat = 1; 62 - static unsigned int led_diskio = 1; 63 - static unsigned int led_lanrxtx = 1; 64 - static char lcd_text[32]; 65 - static char lcd_text_default[32]; 61 + static unsigned int led_heartbeat __read_mostly = 1; 62 + static unsigned int led_diskio __read_mostly = 1; 63 + static unsigned int led_lanrxtx __read_mostly = 1; 64 + static char lcd_text[32] __read_mostly; 65 + static char lcd_text_default[32] __read_mostly; 66 66 67 67 68 68 static struct workqueue_struct *led_wq; ··· 108 108 /* lcd_info is pre-initialized to the values needed to program KittyHawk LCD's 109 109 * HP seems to have used Sharp/Hitachi HD44780 LCDs most of the time. */ 110 110 static struct pdc_chassis_lcd_info_ret_block 111 - lcd_info __attribute__((aligned(8))) = 111 + lcd_info __attribute__((aligned(8))) __read_mostly = 112 112 { 113 113 .model = DISPLAY_MODEL_LCD, 114 114 .lcd_width = 16, ··· 144 144 device_initcall(start_task); 145 145 146 146 /* ptr to LCD/LED-specific function */ 147 - static void (*led_func_ptr) (unsigned char); 147 + static void (*led_func_ptr) (unsigned char) __read_mostly; 148 148 149 149 #ifdef CONFIG_PROC_FS 150 150 static int led_proc_read(char *page, char **start, off_t off, int count,
+1 -1
drivers/parisc/pdc_stable.c
··· 70 70 MODULE_LICENSE("GPL"); 71 71 MODULE_VERSION(PDCS_VERSION); 72 72 73 - static unsigned long pdcs_size = 0; 73 + static unsigned long pdcs_size __read_mostly; 74 74 75 75 /* This struct defines what we need to deal with a parisc pdc path entry */ 76 76 struct pdcspath_entry {
+6 -6
drivers/parisc/power.c
··· 2 2 * linux/arch/parisc/kernel/power.c 3 3 * HP PARISC soft power switch support driver 4 4 * 5 - * Copyright (c) 2001-2002 Helge Deller <deller@gmx.de> 5 + * Copyright (c) 2001-2005 Helge Deller <deller@gmx.de> 6 6 * All rights reserved. 7 7 * 8 8 * ··· 102 102 103 103 static void poweroff(void) 104 104 { 105 - static int powering_off; 105 + static int powering_off __read_mostly; 106 106 107 107 if (powering_off) 108 108 return; ··· 113 113 114 114 115 115 /* local time-counter for shutdown */ 116 - static int shutdown_timer; 116 + static int shutdown_timer __read_mostly; 117 117 118 118 /* check, give feedback and start shutdown after one second */ 119 119 static void process_shutdown(void) ··· 139 139 DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0); 140 140 141 141 /* soft power switch enabled/disabled */ 142 - int pwrsw_enabled = 1; 142 + int pwrsw_enabled __read_mostly = 1; 143 143 144 144 /* 145 145 * On gecko style machines (e.g. 712/xx and 715/xx) ··· 149 149 */ 150 150 static void gecko_tasklet_func(unsigned long unused) 151 151 { 152 - if (!pwrsw_enabled) 152 + if (unlikely(!pwrsw_enabled)) 153 153 return; 154 154 155 155 if (__getDIAG(25) & 0x80000000) { ··· 173 173 { 174 174 unsigned long current_status; 175 175 176 - if (!pwrsw_enabled) 176 + if (unlikely(!pwrsw_enabled)) 177 177 return; 178 178 179 179 current_status = gsc_readl(soft_power_reg);
+1 -1
include/linux/cache.h
··· 13 13 #define SMP_CACHE_BYTES L1_CACHE_BYTES 14 14 #endif 15 15 16 - #if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) 16 + #if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC) 17 17 #define __read_mostly __attribute__((__section__(".data.read_mostly"))) 18 18 #else 19 19 #define __read_mostly