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

[PATCH] Additions to .data.read_mostly section

Mark variables which are usually accessed for reads with __readmostly.

Signed-off-by: Alok N Kataria <alokk@calsoftinc.com>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Ravikiran G Thirumalai and committed by
Linus Torvalds
6c231b7b 39ed3fde

+31 -31
+5 -5
arch/i386/kernel/io_apic.c
··· 78 78 int apic, pin, next; 79 79 } irq_2_pin[PIN_MAP_SIZE]; 80 80 81 - int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; 81 + int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1}; 82 82 #ifdef CONFIG_PCI_MSI 83 83 #define vector_to_irq(vector) \ 84 84 (platform_legacy_irq(vector) ? vector : vector_irq[vector]) ··· 1119 1119 } 1120 1120 1121 1121 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ 1122 - u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; 1122 + u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }; 1123 1123 1124 1124 int assign_irq_vector(int irq) 1125 1125 { ··· 1990 1990 * edge-triggered handler, without risking IRQ storms and other ugly 1991 1991 * races. 1992 1992 */ 1993 - static struct hw_interrupt_type ioapic_edge_type = { 1993 + static struct hw_interrupt_type ioapic_edge_type __read_mostly = { 1994 1994 .typename = "IO-APIC-edge", 1995 1995 .startup = startup_edge_ioapic, 1996 1996 .shutdown = shutdown_edge_ioapic, ··· 2003 2003 #endif 2004 2004 }; 2005 2005 2006 - static struct hw_interrupt_type ioapic_level_type = { 2006 + static struct hw_interrupt_type ioapic_level_type __read_mostly = { 2007 2007 .typename = "IO-APIC-level", 2008 2008 .startup = startup_level_ioapic, 2009 2009 .shutdown = shutdown_level_ioapic, ··· 2076 2076 2077 2077 static void end_lapic_irq (unsigned int i) { /* nothing */ } 2078 2078 2079 - static struct hw_interrupt_type lapic_irq_type = { 2079 + static struct hw_interrupt_type lapic_irq_type __read_mostly = { 2080 2080 .typename = "local-APIC-edge", 2081 2081 .startup = NULL, /* startup_irq() not used for IRQ0 */ 2082 2082 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
+1 -1
arch/i386/kernel/timers/timer_hpet.c
··· 19 19 #include <asm/hpet.h> 20 20 21 21 static unsigned long hpet_usec_quotient __read_mostly; /* convert hpet clks to usec */ 22 - static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */ 22 + static unsigned long tsc_hpet_quotient __read_mostly; /* convert tsc to hpet clks */ 23 23 static unsigned long hpet_last; /* hpet counter value at last tick*/ 24 24 static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ 25 25 static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */
+4 -4
arch/i386/mm/discontig.c
··· 37 37 #include <asm/mmzone.h> 38 38 #include <bios_ebda.h> 39 39 40 - struct pglist_data *node_data[MAX_NUMNODES]; 40 + struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 41 41 EXPORT_SYMBOL(node_data); 42 42 bootmem_data_t node0_bdata; 43 43 ··· 49 49 * 2) node_start_pfn - the starting page frame number for a node 50 50 * 3) node_end_pfn - the ending page fram number for a node 51 51 */ 52 - unsigned long node_start_pfn[MAX_NUMNODES]; 53 - unsigned long node_end_pfn[MAX_NUMNODES]; 52 + unsigned long node_start_pfn[MAX_NUMNODES] __read_mostly; 53 + unsigned long node_end_pfn[MAX_NUMNODES] __read_mostly; 54 54 55 55 56 56 #ifdef CONFIG_DISCONTIGMEM ··· 66 66 * physnode_map[4-7] = 1; 67 67 * physnode_map[8- ] = -1; 68 68 */ 69 - s8 physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1}; 69 + s8 physnode_map[MAX_ELEMENTS] __read_mostly = { [0 ... (MAX_ELEMENTS - 1)] = -1}; 70 70 EXPORT_SYMBOL(physnode_map); 71 71 72 72 void memory_present(int nid, unsigned long start, unsigned long end)
+1 -1
arch/i386/mm/init.c
··· 393 393 } 394 394 395 395 static int disable_nx __initdata = 0; 396 - u64 __supported_pte_mask = ~_PAGE_NX; 396 + u64 __supported_pte_mask __read_mostly = ~_PAGE_NX; 397 397 398 398 /* 399 399 * noexec = on|off
+1 -1
arch/x86_64/kernel/genapic.c
··· 25 25 #endif 26 26 27 27 /* which logical CPU number maps to which CPU (physical APIC ID) */ 28 - u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 28 + u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; 29 29 EXPORT_SYMBOL(x86_cpu_to_apicid); 30 30 u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 31 31
+5 -5
arch/x86_64/kernel/io_apic.c
··· 70 70 short apic, pin, next; 71 71 } irq_2_pin[PIN_MAP_SIZE]; 72 72 73 - int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; 73 + int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1}; 74 74 #ifdef CONFIG_PCI_MSI 75 75 #define vector_to_irq(vector) \ 76 76 (platform_legacy_irq(vector) ? vector : vector_irq[vector]) ··· 683 683 } 684 684 685 685 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ 686 - u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; 686 + u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }; 687 687 688 688 int assign_irq_vector(int irq) 689 689 { ··· 1443 1443 * races. 1444 1444 */ 1445 1445 1446 - static struct hw_interrupt_type ioapic_edge_type = { 1446 + static struct hw_interrupt_type ioapic_edge_type __read_mostly = { 1447 1447 .typename = "IO-APIC-edge", 1448 1448 .startup = startup_edge_ioapic, 1449 1449 .shutdown = shutdown_edge_ioapic, ··· 1456 1456 #endif 1457 1457 }; 1458 1458 1459 - static struct hw_interrupt_type ioapic_level_type = { 1459 + static struct hw_interrupt_type ioapic_level_type __read_mostly = { 1460 1460 .typename = "IO-APIC-level", 1461 1461 .startup = startup_level_ioapic, 1462 1462 .shutdown = shutdown_level_ioapic, ··· 1529 1529 1530 1530 static void end_lapic_irq (unsigned int i) { /* nothing */ } 1531 1531 1532 - static struct hw_interrupt_type lapic_irq_type = { 1532 + static struct hw_interrupt_type lapic_irq_type __read_mostly = { 1533 1533 .typename = "local-APIC-edge", 1534 1534 .startup = NULL, /* startup_irq() not used for IRQ0 */ 1535 1535 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
+1 -1
arch/x86_64/kernel/setup.c
··· 65 65 * Machine setup.. 66 66 */ 67 67 68 - struct cpuinfo_x86 boot_cpu_data; 68 + struct cpuinfo_x86 boot_cpu_data __read_mostly; 69 69 70 70 unsigned long mmu_cr4_features; 71 71
+1 -1
arch/x86_64/kernel/setup64.c
··· 36 36 37 37 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 38 38 39 - unsigned long __supported_pte_mask = ~0UL; 39 + unsigned long __supported_pte_mask __read_mostly = ~0UL; 40 40 static int do_not_nx __initdata = 0; 41 41 42 42 /* noexec=on|off
+5 -5
arch/x86_64/kernel/smpboot.c
··· 62 62 /* Number of siblings per CPU package */ 63 63 int smp_num_siblings = 1; 64 64 /* Package ID of each logical CPU */ 65 - u8 phys_proc_id[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 66 - u8 cpu_core_id[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 65 + u8 phys_proc_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; 66 + u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; 67 67 EXPORT_SYMBOL(phys_proc_id); 68 68 EXPORT_SYMBOL(cpu_core_id); 69 69 70 70 /* Bitmask of currently online CPUs */ 71 - cpumask_t cpu_online_map; 71 + cpumask_t cpu_online_map __read_mostly; 72 72 73 73 EXPORT_SYMBOL(cpu_online_map); 74 74 ··· 88 88 /* Set when the idlers are all forked */ 89 89 int smp_threads_ready; 90 90 91 - cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; 92 - cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; 91 + cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 92 + cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 93 93 EXPORT_SYMBOL(cpu_core_map); 94 94 95 95 /*
+3 -3
arch/x86_64/mm/numa.c
··· 22 22 #define Dprintk(x...) 23 23 #endif 24 24 25 - struct pglist_data *node_data[MAX_NUMNODES]; 25 + struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 26 26 bootmem_data_t plat_node_bdata[MAX_NUMNODES]; 27 27 28 28 int memnode_shift; 29 29 u8 memnodemap[NODEMAPSIZE]; 30 30 31 - unsigned char cpu_to_node[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; 32 - cpumask_t node_to_cpumask[MAX_NUMNODES]; 31 + unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; 32 + cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; 33 33 34 34 int numa_off __initdata; 35 35
+1 -1
fs/namespace.c
··· 40 40 __cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock); 41 41 42 42 static struct list_head *mount_hashtable; 43 - static int hash_mask, hash_bits; 43 + static int hash_mask __read_mostly, hash_bits __read_mostly; 44 44 static kmem_cache_t *mnt_cache; 45 45 46 46 static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
+2 -2
mm/page_alloc.c
··· 47 47 nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL; 48 48 EXPORT_SYMBOL(node_possible_map); 49 49 struct pglist_data *pgdat_list __read_mostly; 50 - unsigned long totalram_pages; 51 - unsigned long totalhigh_pages; 50 + unsigned long totalram_pages __read_mostly; 51 + unsigned long totalhigh_pages __read_mostly; 52 52 long nr_swap_pages; 53 53 54 54 /*
+1 -1
mm/shmem.c
··· 180 180 static struct inode_operations shmem_dir_inode_operations; 181 181 static struct vm_operations_struct shmem_vm_ops; 182 182 183 - static struct backing_dev_info shmem_backing_dev_info = { 183 + static struct backing_dev_info shmem_backing_dev_info __read_mostly = { 184 184 .ra_pages = 0, /* No readahead */ 185 185 .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, 186 186 .unplug_io_fn = default_unplug_io_fn,