1
0
Fork 0

[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>
hifive-unleashed-5.1
Helge Deller 2006-01-10 20:35:03 -05:00 committed by Kyle McMartin
parent 02706647a4
commit 8039de10aa
24 changed files with 79 additions and 73 deletions

View File

@ -29,9 +29,9 @@
#include <asm/processor.h>
#include <asm/sections.h>
int split_tlb;
int dcache_stride;
int icache_stride;
int split_tlb __read_mostly;
int dcache_stride __read_mostly;
int icache_stride __read_mostly;
EXPORT_SYMBOL(dcache_stride);
@ -45,9 +45,9 @@ DEFINE_SPINLOCK(pa_tlb_lock);
EXPORT_SYMBOL(pa_tlb_lock);
#endif
struct pdc_cache_info cache_info;
struct pdc_cache_info cache_info __read_mostly;
#ifndef CONFIG_PA20
static struct pdc_btlb_info btlb_info;
static struct pdc_btlb_info btlb_info __read_mostly;
#endif
#ifdef CONFIG_SMP
@ -332,7 +332,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr)
}
#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
int parisc_cache_flush_threshold = FLUSH_THRESHOLD;
int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD;
void parisc_setup_cache_timing(void)
{

View File

@ -39,7 +39,7 @@
#include <asm/parisc-device.h>
/* See comments in include/asm-parisc/pci.h */
struct hppa_dma_ops *hppa_dma_ops;
struct hppa_dma_ops *hppa_dma_ops __read_mostly;
EXPORT_SYMBOL(hppa_dma_ops);
static struct device root = {

View File

@ -80,7 +80,7 @@ static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
/* Firmware needs to be initially set to narrow to determine the
* actual firmware width. */
int parisc_narrow_firmware = 1;
int parisc_narrow_firmware __read_mostly = 1;
#endif
/* On most currently-supported platforms, IODC I/O calls are 32-bit calls

View File

@ -38,7 +38,7 @@
*/
#undef DEBUG_PAT
int pdc_type = PDC_TYPE_ILLEGAL;
int pdc_type __read_mostly = PDC_TYPE_ILLEGAL;
void __init setup_pdc(void)
{
@ -120,8 +120,8 @@ set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start,
* pdc info is bad in this case).
*/
if ( ((start & (PAGE_SIZE - 1)) != 0)
|| ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) ) {
if (unlikely( ((start & (PAGE_SIZE - 1)) != 0)
|| ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) {
panic("Memory range doesn't align with page size!\n");
}

View File

@ -33,10 +33,10 @@
#include <asm/uaccess.h>
#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
static struct proc_dir_entry * proc_gsc_root = NULL;
static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
static unsigned long pcxl_used_bytes = 0;
static unsigned long pcxl_used_pages = 0;
static unsigned long pcxl_used_bytes __read_mostly = 0;
static unsigned long pcxl_used_pages __read_mostly = 0;
extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */
static spinlock_t pcxl_res_lock;

View File

@ -30,6 +30,7 @@
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/cache.h>
#include <asm/pdc_chassis.h>
#include <asm/processor.h>
@ -38,8 +39,8 @@
#ifdef CONFIG_PDC_CHASSIS
static int pdc_chassis_old = 0;
static unsigned int pdc_chassis_enabled = 1;
static int pdc_chassis_old __read_mostly = 0;
static unsigned int pdc_chassis_enabled __read_mostly = 1;
/**
@ -132,7 +133,7 @@ void __init parisc_pdc_chassis_init(void)
{
#ifdef CONFIG_PDC_CHASSIS
int handle = 0;
if (pdc_chassis_enabled) {
if (likely(pdc_chassis_enabled)) {
DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__);
/* Let see if we have something to handle... */
@ -142,7 +143,7 @@ void __init parisc_pdc_chassis_init(void)
printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n");
handle = 1;
}
else if (pdc_chassis_old) {
else if (unlikely(pdc_chassis_old)) {
printk(KERN_INFO "Enabling old style chassis LED panel support.\n");
handle = 1;
}
@ -178,7 +179,7 @@ int pdc_chassis_send_status(int message)
/* Maybe we should do that in an other way ? */
int retval = 0;
#ifdef CONFIG_PDC_CHASSIS
if (pdc_chassis_enabled) {
if (likely(pdc_chassis_enabled)) {
DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message);
@ -214,7 +215,7 @@ int pdc_chassis_send_status(int message)
}
} else retval = -1;
#else
if (pdc_chassis_old) {
if (unlikely(pdc_chassis_old)) {
switch (message) {
case PDC_CHASSIS_DIRECT_BSTART:
case PDC_CHASSIS_DIRECT_BCOMPLETE:

View File

@ -66,10 +66,10 @@ struct rdr_tbl_ent {
uint8_t write_control;
};
static int perf_processor_interface = UNKNOWN_INTF;
static int perf_enabled = 0;
static int perf_processor_interface __read_mostly = UNKNOWN_INTF;
static int perf_enabled __read_mostly = 0;
static spinlock_t perf_lock;
struct parisc_device *cpu_device = NULL;
struct parisc_device *cpu_device __read_mostly = NULL;
/* RDRs to write for PCX-W */
static int perf_rdrs_W[] =

View File

@ -54,7 +54,7 @@
#include <asm/uaccess.h>
#include <asm/unwind.h>
static int hlt_counter;
static int hlt_counter __read_mostly;
/*
* Power off function, if any

View File

@ -44,10 +44,10 @@
#include <asm/irq.h> /* for struct irq_region */
#include <asm/parisc-device.h>
struct system_cpuinfo_parisc boot_cpu_data;
struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
EXPORT_SYMBOL(boot_cpu_data);
struct cpuinfo_parisc cpu_data[NR_CPUS];
struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly;
/*
** PARISC CPU driver - claim "device" and initialize CPU data structures.
@ -378,12 +378,12 @@ show_cpuinfo (struct seq_file *m, void *v)
return 0;
}
static struct parisc_device_id processor_tbl[] = {
static struct parisc_device_id processor_tbl[] __read_mostly = {
{ HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
{ 0, }
};
static struct parisc_driver cpu_driver = {
static struct parisc_driver cpu_driver __read_mostly = {
.name = "CPU",
.id_table = processor_tbl,
.probe = processor_probe

View File

@ -46,15 +46,15 @@
#include <asm/io.h>
#include <asm/setup.h>
char command_line[COMMAND_LINE_SIZE];
char command_line[COMMAND_LINE_SIZE] __read_mostly;
/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
struct proc_dir_entry * proc_runway_root = NULL;
struct proc_dir_entry * proc_gsc_root = NULL;
struct proc_dir_entry * proc_mckinley_root = NULL;
struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
#if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA))
int parisc_bus_is_phys = 1; /* Assume no IOMMU is present */
int parisc_bus_is_phys __read_mostly = 1; /* Assume no IOMMU is present */
EXPORT_SYMBOL(parisc_bus_is_phys);
#endif

View File

@ -58,9 +58,9 @@ DEFINE_SPINLOCK(smp_lock);
volatile struct task_struct *smp_init_current_idle_task;
static volatile int cpu_now_booting = 0; /* track which CPU is booting */
static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is booting */
static int parisc_max_cpus = 1;
static int parisc_max_cpus __read_mostly = 1;
/* online cpus are ones that we've managed to bring up completely
* possible cpus are all valid cpu
@ -71,8 +71,8 @@ static int parisc_max_cpus = 1;
* empty in the beginning.
*/
cpumask_t cpu_online_map = CPU_MASK_NONE; /* Bitmap of online CPUs */
cpumask_t cpu_possible_map = CPU_MASK_ALL; /* Bitmap of Present CPUs */
cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */
cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */
EXPORT_SYMBOL(cpu_online_map);
EXPORT_SYMBOL(cpu_possible_map);

View File

@ -36,8 +36,8 @@
/* xtime and wall_jiffies keep wall-clock time */
extern unsigned long wall_jiffies;
static long clocktick; /* timer cycles per tick */
static long halftick;
static long clocktick __read_mostly; /* timer cycles per tick */
static long halftick __read_mostly;
#ifdef CONFIG_SMP
extern void smp_do_timer(struct pt_regs *regs);

View File

@ -20,8 +20,9 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/cpu.h>
#include <linux/cache.h>
static struct cpu cpu_devices[NR_CPUS];
static struct cpu cpu_devices[NR_CPUS] __read_mostly;
static int __init topology_init(void)
{

View File

@ -122,7 +122,7 @@
#define ERR_NOTHANDLED -1
#define ERR_PAGEFAULT -2
int unaligned_enabled = 1;
int unaligned_enabled __read_mostly = 1;
void die_if_kernel (char *str, struct pt_regs *regs, long err);

View File

@ -35,7 +35,7 @@ static spinlock_t unwind_lock;
* we can call unwind_init as early in the bootup process as
* possible (before the slab allocator is initialized)
*/
static struct unwind_table kernel_unwind_table;
static struct unwind_table kernel_unwind_table __read_mostly;
static LIST_HEAD(unwind_tables);
static inline const struct unwind_table_entry *

View File

@ -105,6 +105,10 @@ SECTIONS
. = ALIGN(16);
.data.lock_aligned : { *(.data.lock_aligned) }
/* rarely changed data like cpu maps */
. = ALIGN(16);
.data.read_mostly : { *(.data.read_mostly) }
_edata = .; /* End of data section */
. = ALIGN(16384); /* init_task */

View File

@ -36,9 +36,9 @@ extern char _end; /* end of BSS, defined by linker */
extern char __init_begin, __init_end;
#ifdef CONFIG_DISCONTIGMEM
struct node_map_data node_data[MAX_NUMNODES];
bootmem_data_t bmem_data[MAX_NUMNODES];
unsigned char pfnnid_map[PFNNID_MAP_MAX];
struct node_map_data node_data[MAX_NUMNODES] __read_mostly;
bootmem_data_t bmem_data[MAX_NUMNODES] __read_mostly;
unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
#endif
static struct resource data_resource = {
@ -58,14 +58,14 @@ static struct resource pdcdata_resource = {
.flags = IORESOURCE_BUSY | IORESOURCE_MEM,
};
static struct resource sysram_resources[MAX_PHYSMEM_RANGES];
static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
/* The following array is initialized from the firmware specific
* information retrieved in kernel/inventory.c.
*/
physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES];
int npmem_ranges;
physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
int npmem_ranges __read_mostly;
#ifdef __LP64__
#define MAX_MEM (~0UL)
@ -73,7 +73,7 @@ int npmem_ranges;
#define MAX_MEM (3584U*1024U*1024U)
#endif /* !__LP64__ */
static unsigned long mem_limit = MAX_MEM;
static unsigned long mem_limit __read_mostly = MAX_MEM;
static void __init mem_limit_func(void)
{
@ -431,11 +431,11 @@ void free_initmem(void)
#define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \
& ~(VM_MAP_OFFSET-1)))
void *vmalloc_start;
void *vmalloc_start __read_mostly;
EXPORT_SYMBOL(vmalloc_start);
#ifdef CONFIG_PA11
unsigned long pcxl_dma_start;
unsigned long pcxl_dma_start __read_mostly;
#endif
void __init mem_init(void)
@ -475,7 +475,7 @@ int do_check_pgt_cache(int low, int high)
return 0;
}
unsigned long *empty_zero_page;
unsigned long *empty_zero_page __read_mostly;
void show_mem(void)
{

View File

@ -57,7 +57,7 @@
static DEFINE_SPINLOCK(eisa_irq_lock);
void __iomem *eisa_eeprom_addr;
void __iomem *eisa_eeprom_addr __read_mostly;
/* We can only have one EISA adapter in the system because neither
* implementation can be flexed.
@ -141,7 +141,7 @@ static int slave_mask;
* in the furure.
*/
/* irq 13,8,2,1,0 must be edge */
static unsigned int eisa_irq_level; /* default to edge triggered */
static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered */
/* called by free irq */

View File

@ -150,7 +150,7 @@ void __init lasi_led_init(unsigned long lasi_hpa)
*
*/
static unsigned long lasi_power_off_hpa;
static unsigned long lasi_power_off_hpa __read_mostly;
static void lasi_power_off(void)
{

View File

@ -167,7 +167,7 @@
/* non-postable I/O port space, densely packed */
#define LBA_PORT_BASE (PCI_F_EXTEND | 0xfee00000UL)
static void __iomem *astro_iop_base;
static void __iomem *astro_iop_base __read_mostly;
#define ELROY_HVERS 0x782
#define MERCURY_HVERS 0x783

View File

@ -3,7 +3,7 @@
*
* (c) Copyright 2000 Red Hat Software
* (c) Copyright 2000 Helge Deller <hdeller@redhat.com>
* (c) Copyright 2001-2004 Helge Deller <deller@gmx.de>
* (c) Copyright 2001-2005 Helge Deller <deller@gmx.de>
* (c) Copyright 2001 Randolph Chung <tausq@debian.org>
*
* This program is free software; you can redistribute it and/or modify
@ -56,13 +56,13 @@
relatively large amount of CPU time, some of the calculations can be
turned off with the following variables (controlled via procfs) */
static int led_type = -1;
static int led_type __read_mostly = -1;
static unsigned char lastleds; /* LED state from most recent update */
static unsigned int led_heartbeat = 1;
static unsigned int led_diskio = 1;
static unsigned int led_lanrxtx = 1;
static char lcd_text[32];
static char lcd_text_default[32];
static unsigned int led_heartbeat __read_mostly = 1;
static unsigned int led_diskio __read_mostly = 1;
static unsigned int led_lanrxtx __read_mostly = 1;
static char lcd_text[32] __read_mostly;
static char lcd_text_default[32] __read_mostly;
static struct workqueue_struct *led_wq;
@ -108,7 +108,7 @@ struct pdc_chassis_lcd_info_ret_block {
/* lcd_info is pre-initialized to the values needed to program KittyHawk LCD's
* HP seems to have used Sharp/Hitachi HD44780 LCDs most of the time. */
static struct pdc_chassis_lcd_info_ret_block
lcd_info __attribute__((aligned(8))) =
lcd_info __attribute__((aligned(8))) __read_mostly =
{
.model = DISPLAY_MODEL_LCD,
.lcd_width = 16,
@ -144,7 +144,7 @@ static int start_task(void)
device_initcall(start_task);
/* ptr to LCD/LED-specific function */
static void (*led_func_ptr) (unsigned char);
static void (*led_func_ptr) (unsigned char) __read_mostly;
#ifdef CONFIG_PROC_FS
static int led_proc_read(char *page, char **start, off_t off, int count,

View File

@ -70,7 +70,7 @@ MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data");
MODULE_LICENSE("GPL");
MODULE_VERSION(PDCS_VERSION);
static unsigned long pdcs_size = 0;
static unsigned long pdcs_size __read_mostly;
/* This struct defines what we need to deal with a parisc pdc path entry */
struct pdcspath_entry {

View File

@ -2,7 +2,7 @@
* linux/arch/parisc/kernel/power.c
* HP PARISC soft power switch support driver
*
* Copyright (c) 2001-2002 Helge Deller <deller@gmx.de>
* Copyright (c) 2001-2005 Helge Deller <deller@gmx.de>
* All rights reserved.
*
*
@ -102,7 +102,7 @@ static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL);
static void poweroff(void)
{
static int powering_off;
static int powering_off __read_mostly;
if (powering_off)
return;
@ -113,7 +113,7 @@ static void poweroff(void)
/* local time-counter for shutdown */
static int shutdown_timer;
static int shutdown_timer __read_mostly;
/* check, give feedback and start shutdown after one second */
static void process_shutdown(void)
@ -139,7 +139,7 @@ static void process_shutdown(void)
DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0);
/* soft power switch enabled/disabled */
int pwrsw_enabled = 1;
int pwrsw_enabled __read_mostly = 1;
/*
* On gecko style machines (e.g. 712/xx and 715/xx)
@ -149,7 +149,7 @@ int pwrsw_enabled = 1;
*/
static void gecko_tasklet_func(unsigned long unused)
{
if (!pwrsw_enabled)
if (unlikely(!pwrsw_enabled))
return;
if (__getDIAG(25) & 0x80000000) {
@ -173,7 +173,7 @@ static void polling_tasklet_func(unsigned long soft_power_reg)
{
unsigned long current_status;
if (!pwrsw_enabled)
if (unlikely(!pwrsw_enabled))
return;
current_status = gsc_readl(soft_power_reg);

View File

@ -13,7 +13,7 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#endif
#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64)
#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC)
#define __read_mostly __attribute__((__section__(".data.read_mostly")))
#else
#define __read_mostly