Use __read_mostly on these variables, to reduce the probability of false

sharing.
This commit is contained in:
maxv 2017-02-02 08:57:04 +00:00
parent 68068a92f5
commit a4a4753729
5 changed files with 18 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.121 2016/10/16 10:24:58 maxv Exp $ */
/* $NetBSD: cpu.c,v 1.122 2017/02/02 08:57:04 maxv Exp $ */
/*-
* Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.121 2016/10/16 10:24:58 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.122 2017/02/02 08:57:04 maxv Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@ -177,7 +177,7 @@ static void tss_init(struct i386tss *, void *, void *);
static void cpu_init_idle_lwp(struct cpu_info *);
uint32_t cpu_feature[7]; /* X86 CPUID feature bits */
uint32_t cpu_feature[7] __read_mostly; /* X86 CPUID feature bits */
/* [0] basic features cpuid.1:%edx
* [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
* [2] extended features cpuid:80000001:%edx

View File

@ -1,4 +1,4 @@
/* $NetBSD: identcpu.c,v 1.51 2016/12/17 15:23:08 maxv Exp $ */
/* $NetBSD: identcpu.c,v 1.52 2017/02/02 08:57:04 maxv Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.51 2016/12/17 15:23:08 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.52 2017/02/02 08:57:04 maxv Exp $");
#include "opt_xen.h"
@ -61,9 +61,9 @@ static const struct x86_cache_info amd_cpuid_l3cache_assoc_info[] =
int cpu_vendor;
char cpu_brand_string[49];
int x86_fpu_save = FPU_SAVE_FSAVE;
unsigned int x86_fpu_save_size = 512;
uint64_t x86_xsave_features = 0;
int x86_fpu_save __read_mostly = FPU_SAVE_FSAVE;
unsigned int x86_fpu_save_size __read_mostly = 512;
uint64_t x86_xsave_features __read_mostly = 0;
/*
* Note: these are just the ones that may not have a cpuid instruction.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.237 2017/01/22 20:04:35 maxv Exp $ */
/* $NetBSD: pmap.c,v 1.238 2017/02/02 08:57:04 maxv Exp $ */
/*-
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.237 2017/01/22 20:04:35 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.238 2017/02/02 08:57:04 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@ -480,8 +480,8 @@ static vaddr_t virtual_end __read_mostly; /* VA of last free KVA */
/*
* LAPIC virtual address, and fake physical address.
*/
volatile vaddr_t local_apic_va;
paddr_t local_apic_pa;
volatile vaddr_t local_apic_va __read_mostly;
paddr_t local_apic_pa __read_mostly;
#endif
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.106 2017/01/22 19:42:48 maxv Exp $ */
/* $NetBSD: cpu.c,v 1.107 2017/02/02 08:57:04 maxv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2017/01/22 19:42:48 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2017/02/02 08:57:04 maxv Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -171,7 +171,7 @@ struct cpu_info phycpu_info_primary __aligned(CACHE_LINE_SIZE) = {
struct cpu_info *cpu_info_list = &cpu_info_primary;
struct cpu_info *phycpu_info_list = &phycpu_info_primary;
uint32_t cpu_feature[7]; /* X86 CPUID feature bits
uint32_t cpu_feature[7] __read_mostly; /* X86 CPUID feature bits
* [0] basic features %edx
* [1] basic features %ecx
* [2] extended features %edx

View File

@ -1,4 +1,4 @@
/* $NetBSD: x86_xpmap.c,v 1.70 2017/01/22 19:24:51 maxv Exp $ */
/* $NetBSD: x86_xpmap.c,v 1.71 2017/02/02 08:57:04 maxv Exp $ */
/*
* Copyright (c) 2006 Mathieu Ropert <mro@adviseo.fr>
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.70 2017/01/22 19:24:51 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.71 2017/02/02 08:57:04 maxv Exp $");
#include "opt_xen.h"
#include "opt_ddb.h"
@ -105,7 +105,7 @@ unsigned long *xpmap_phys_to_machine_mapping;
kmutex_t pte_lock;
vaddr_t xen_dummy_page;
pt_entry_t xpmap_pg_nx;
pt_entry_t xpmap_pg_nx __read_mostly;
void xen_failsafe_handler(void);