Skip to content

Commit 8039de1

Browse files
Helge DellerKyle McMartin
authored andcommitted
[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>
1 parent 0270664 commit 8039de1

24 files changed

Lines changed: 79 additions & 73 deletions

‎arch/parisc/kernel/cache.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
#include <asm/processor.h>
3030
#include <asm/sections.h>
3131

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;
3535
EXPORT_SYMBOL(dcache_stride);
3636

3737

@@ -45,9 +45,9 @@ DEFINE_SPINLOCK(pa_tlb_lock);
4545
EXPORT_SYMBOL(pa_tlb_lock);
4646
#endif
4747

48-
struct pdc_cache_info cache_info;
48+
struct pdc_cache_info cache_info __read_mostly;
4949
#ifndef CONFIG_PA20
50-
static struct pdc_btlb_info btlb_info;
50+
static struct pdc_btlb_info btlb_info __read_mostly;
5151
#endif
5252

5353
#ifdef CONFIG_SMP
@@ -332,7 +332,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr)
332332
}
333333

334334
#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
335-
int parisc_cache_flush_threshold = FLUSH_THRESHOLD;
335+
int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD;
336336

337337
void parisc_setup_cache_timing(void)
338338
{

‎arch/parisc/kernel/drivers.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <asm/parisc-device.h>
4040

4141
/* 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;
4343
EXPORT_SYMBOL(hppa_dma_ops);
4444

4545
static struct device root = {

‎arch/parisc/kernel/firmware.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
8080

8181
/* Firmware needs to be initially set to narrow to determine the
8282
* actual firmware width. */
83-
int parisc_narrow_firmware = 1;
83+
int parisc_narrow_firmware __read_mostly = 1;
8484
#endif
8585

8686
/* On most currently-supported platforms, IODC I/O calls are 32-bit calls

‎arch/parisc/kernel/inventory.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*/
3939
#undef DEBUG_PAT
4040

41-
int pdc_type = PDC_TYPE_ILLEGAL;
41+
int pdc_type __read_mostly = PDC_TYPE_ILLEGAL;
4242

4343
void __init setup_pdc(void)
4444
{
@@ -120,8 +120,8 @@ set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start,
120120
* pdc info is bad in this case).
121121
*/
122122

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) )) {
125125

126126
panic("Memory range doesn't align with page size!\n");
127127
}

‎arch/parisc/kernel/pci-dma.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
#include <asm/uaccess.h>
3434
#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
3535

36-
static struct proc_dir_entry * proc_gsc_root = NULL;
36+
static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
3737
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;
4040

4141
extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */
4242
static spinlock_t pcxl_res_lock;

‎arch/parisc/kernel/pdc_chassis.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/kernel.h>
3131
#include <linux/reboot.h>
3232
#include <linux/notifier.h>
33+
#include <linux/cache.h>
3334

3435
#include <asm/pdc_chassis.h>
3536
#include <asm/processor.h>
@@ -38,8 +39,8 @@
3839

3940

4041
#ifdef CONFIG_PDC_CHASSIS
41-
static int pdc_chassis_old = 0;
42-
static unsigned int pdc_chassis_enabled = 1;
42+
static int pdc_chassis_old __read_mostly = 0;
43+
static unsigned int pdc_chassis_enabled __read_mostly = 1;
4344

4445

4546
/**
@@ -132,7 +133,7 @@ void __init parisc_pdc_chassis_init(void)
132133
{
133134
#ifdef CONFIG_PDC_CHASSIS
134135
int handle = 0;
135-
if (pdc_chassis_enabled) {
136+
if (likely(pdc_chassis_enabled)) {
136137
DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__);
137138

138139
/* Let see if we have something to handle... */
@@ -142,7 +143,7 @@ void __init parisc_pdc_chassis_init(void)
142143
printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n");
143144
handle = 1;
144145
}
145-
else if (pdc_chassis_old) {
146+
else if (unlikely(pdc_chassis_old)) {
146147
printk(KERN_INFO "Enabling old style chassis LED panel support.\n");
147148
handle = 1;
148149
}
@@ -178,7 +179,7 @@ int pdc_chassis_send_status(int message)
178179
/* Maybe we should do that in an other way ? */
179180
int retval = 0;
180181
#ifdef CONFIG_PDC_CHASSIS
181-
if (pdc_chassis_enabled) {
182+
if (likely(pdc_chassis_enabled)) {
182183

183184
DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message);
184185

@@ -214,7 +215,7 @@ int pdc_chassis_send_status(int message)
214215
}
215216
} else retval = -1;
216217
#else
217-
if (pdc_chassis_old) {
218+
if (unlikely(pdc_chassis_old)) {
218219
switch (message) {
219220
case PDC_CHASSIS_DIRECT_BSTART:
220221
case PDC_CHASSIS_DIRECT_BCOMPLETE:

‎arch/parisc/kernel/perf.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ struct rdr_tbl_ent {
6666
uint8_t write_control;
6767
};
6868

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;
7171
static spinlock_t perf_lock;
72-
struct parisc_device *cpu_device = NULL;
72+
struct parisc_device *cpu_device __read_mostly = NULL;
7373

7474
/* RDRs to write for PCX-W */
7575
static int perf_rdrs_W[] =

‎arch/parisc/kernel/process.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include <asm/uaccess.h>
5555
#include <asm/unwind.h>
5656

57-
static int hlt_counter;
57+
static int hlt_counter __read_mostly;
5858

5959
/*
6060
* Power off function, if any

‎arch/parisc/kernel/processor.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
#include <asm/irq.h> /* for struct irq_region */
4545
#include <asm/parisc-device.h>
4646

47-
struct system_cpuinfo_parisc boot_cpu_data;
47+
struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
4848
EXPORT_SYMBOL(boot_cpu_data);
4949

50-
struct cpuinfo_parisc cpu_data[NR_CPUS];
50+
struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly;
5151

5252
/*
5353
** PARISC CPU driver - claim "device" and initialize CPU data structures.
@@ -378,12 +378,12 @@ show_cpuinfo (struct seq_file *m, void *v)
378378
return 0;
379379
}
380380

381-
static struct parisc_device_id processor_tbl[] = {
381+
static struct parisc_device_id processor_tbl[] __read_mostly = {
382382
{ HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
383383
{ 0, }
384384
};
385385

386-
static struct parisc_driver cpu_driver = {
386+
static struct parisc_driver cpu_driver __read_mostly = {
387387
.name = "CPU",
388388
.id_table = processor_tbl,
389389
.probe = processor_probe

‎arch/parisc/kernel/setup.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
#include <asm/io.h>
4747
#include <asm/setup.h>
4848

49-
char command_line[COMMAND_LINE_SIZE];
49+
char command_line[COMMAND_LINE_SIZE] __read_mostly;
5050

5151
/* 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;
5555

5656
#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 */
5858
EXPORT_SYMBOL(parisc_bus_is_phys);
5959
#endif
6060

0 commit comments

Comments
 (0)