Skip to content

Commit 6c231b7

Browse files
Ravikiran G ThirumalaiLinus Torvalds
authored andcommitted
[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>
1 parent 39ed3fd commit 6c231b7

13 files changed

Lines changed: 31 additions & 31 deletions

File tree

‎arch/i386/kernel/io_apic.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static struct irq_pin_list {
7878
int apic, pin, next;
7979
} irq_2_pin[PIN_MAP_SIZE];
8080

81-
int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
81+
int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
8282
#ifdef CONFIG_PCI_MSI
8383
#define vector_to_irq(vector) \
8484
(platform_legacy_irq(vector) ? vector : vector_irq[vector])
@@ -1119,7 +1119,7 @@ static inline int IO_APIC_irq_trigger(int irq)
11191119
}
11201120

11211121
/* 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 };
11231123

11241124
int assign_irq_vector(int irq)
11251125
{
@@ -1990,7 +1990,7 @@ static void set_ioapic_affinity_vector (unsigned int vector,
19901990
* edge-triggered handler, without risking IRQ storms and other ugly
19911991
* races.
19921992
*/
1993-
static struct hw_interrupt_type ioapic_edge_type = {
1993+
static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
19941994
.typename = "IO-APIC-edge",
19951995
.startup = startup_edge_ioapic,
19961996
.shutdown = shutdown_edge_ioapic,
@@ -2003,7 +2003,7 @@ static struct hw_interrupt_type ioapic_edge_type = {
20032003
#endif
20042004
};
20052005

2006-
static struct hw_interrupt_type ioapic_level_type = {
2006+
static struct hw_interrupt_type ioapic_level_type __read_mostly = {
20072007
.typename = "IO-APIC-level",
20082008
.startup = startup_level_ioapic,
20092009
.shutdown = shutdown_level_ioapic,
@@ -2076,7 +2076,7 @@ static void ack_lapic_irq (unsigned int irq)
20762076

20772077
static void end_lapic_irq (unsigned int i) { /* nothing */ }
20782078

2079-
static struct hw_interrupt_type lapic_irq_type = {
2079+
static struct hw_interrupt_type lapic_irq_type __read_mostly = {
20802080
.typename = "local-APIC-edge",
20812081
.startup = NULL, /* startup_irq() not used for IRQ0 */
20822082
.shutdown = NULL, /* shutdown_irq() not used for IRQ0 */

‎arch/i386/kernel/timers/timer_hpet.c‎

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

2121
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 */
2323
static unsigned long hpet_last; /* hpet counter value at last tick*/
2424
static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */
2525
static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */

‎arch/i386/mm/discontig.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include <asm/mmzone.h>
3838
#include <bios_ebda.h>
3939

40-
struct pglist_data *node_data[MAX_NUMNODES];
40+
struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
4141
EXPORT_SYMBOL(node_data);
4242
bootmem_data_t node0_bdata;
4343

@@ -49,8 +49,8 @@ bootmem_data_t node0_bdata;
4949
* 2) node_start_pfn - the starting page frame number for a node
5050
* 3) node_end_pfn - the ending page fram number for a node
5151
*/
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;
5454

5555

5656
#ifdef CONFIG_DISCONTIGMEM
@@ -66,7 +66,7 @@ unsigned long node_end_pfn[MAX_NUMNODES];
6666
* physnode_map[4-7] = 1;
6767
* physnode_map[8- ] = -1;
6868
*/
69-
s8 physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
69+
s8 physnode_map[MAX_ELEMENTS] __read_mostly = { [0 ... (MAX_ELEMENTS - 1)] = -1};
7070
EXPORT_SYMBOL(physnode_map);
7171

7272
void memory_present(int nid, unsigned long start, unsigned long end)

‎arch/i386/mm/init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void zap_low_mappings (void)
393393
}
394394

395395
static int disable_nx __initdata = 0;
396-
u64 __supported_pte_mask = ~_PAGE_NX;
396+
u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;
397397

398398
/*
399399
* noexec = on|off

‎arch/x86_64/kernel/genapic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif
2626

2727
/* 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 };
2929
EXPORT_SYMBOL(x86_cpu_to_apicid);
3030
u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
3131

‎arch/x86_64/kernel/io_apic.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static struct irq_pin_list {
7070
short apic, pin, next;
7171
} irq_2_pin[PIN_MAP_SIZE];
7272

73-
int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
73+
int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
7474
#ifdef CONFIG_PCI_MSI
7575
#define vector_to_irq(vector) \
7676
(platform_legacy_irq(vector) ? vector : vector_irq[vector])
@@ -683,7 +683,7 @@ static inline int IO_APIC_irq_trigger(int irq)
683683
}
684684

685685
/* 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 };
687687

688688
int assign_irq_vector(int irq)
689689
{
@@ -1443,7 +1443,7 @@ static void set_ioapic_affinity_vector (unsigned int vector,
14431443
* races.
14441444
*/
14451445

1446-
static struct hw_interrupt_type ioapic_edge_type = {
1446+
static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
14471447
.typename = "IO-APIC-edge",
14481448
.startup = startup_edge_ioapic,
14491449
.shutdown = shutdown_edge_ioapic,
@@ -1456,7 +1456,7 @@ static struct hw_interrupt_type ioapic_edge_type = {
14561456
#endif
14571457
};
14581458

1459-
static struct hw_interrupt_type ioapic_level_type = {
1459+
static struct hw_interrupt_type ioapic_level_type __read_mostly = {
14601460
.typename = "IO-APIC-level",
14611461
.startup = startup_level_ioapic,
14621462
.shutdown = shutdown_level_ioapic,
@@ -1529,7 +1529,7 @@ static void ack_lapic_irq (unsigned int irq)
15291529

15301530
static void end_lapic_irq (unsigned int i) { /* nothing */ }
15311531

1532-
static struct hw_interrupt_type lapic_irq_type = {
1532+
static struct hw_interrupt_type lapic_irq_type __read_mostly = {
15331533
.typename = "local-APIC-edge",
15341534
.startup = NULL, /* startup_irq() not used for IRQ0 */
15351535
.shutdown = NULL, /* shutdown_irq() not used for IRQ0 */

‎arch/x86_64/kernel/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
* Machine setup..
6666
*/
6767

68-
struct cpuinfo_x86 boot_cpu_data;
68+
struct cpuinfo_x86 boot_cpu_data __read_mostly;
6969

7070
unsigned long mmu_cr4_features;
7171

‎arch/x86_64/kernel/setup64.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
3636

3737
char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
3838

39-
unsigned long __supported_pte_mask = ~0UL;
39+
unsigned long __supported_pte_mask __read_mostly = ~0UL;
4040
static int do_not_nx __initdata = 0;
4141

4242
/* noexec=on|off

‎arch/x86_64/kernel/smpboot.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@
6262
/* Number of siblings per CPU package */
6363
int smp_num_siblings = 1;
6464
/* 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 };
6767
EXPORT_SYMBOL(phys_proc_id);
6868
EXPORT_SYMBOL(cpu_core_id);
6969

7070
/* Bitmask of currently online CPUs */
71-
cpumask_t cpu_online_map;
71+
cpumask_t cpu_online_map __read_mostly;
7272

7373
EXPORT_SYMBOL(cpu_online_map);
7474

@@ -88,8 +88,8 @@ struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
8888
/* Set when the idlers are all forked */
8989
int smp_threads_ready;
9090

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;
9393
EXPORT_SYMBOL(cpu_core_map);
9494

9595
/*

‎arch/x86_64/mm/numa.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
#define Dprintk(x...)
2323
#endif
2424

25-
struct pglist_data *node_data[MAX_NUMNODES];
25+
struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
2626
bootmem_data_t plat_node_bdata[MAX_NUMNODES];
2727

2828
int memnode_shift;
2929
u8 memnodemap[NODEMAPSIZE];
3030

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;
3333

3434
int numa_off __initdata;
3535

0 commit comments

Comments
 (0)