Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Use __read_mostly on these variables, to reduce the...



details:   https://anonhg.NetBSD.org/src/rev/7b03a7f09a12
branches:  trunk
changeset: 821349:7b03a7f09a12
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Feb 02 08:57:04 2017 +0000

description:
Use __read_mostly on these variables, to reduce the probability of false
sharing.

diffstat:

 sys/arch/x86/x86/cpu.c       |   6 +++---
 sys/arch/x86/x86/identcpu.c  |  10 +++++-----
 sys/arch/x86/x86/pmap.c      |   8 ++++----
 sys/arch/xen/x86/cpu.c       |   6 +++---
 sys/arch/xen/x86/x86_xpmap.c |   6 +++---
 5 files changed, 18 insertions(+), 18 deletions(-)

diffs (141 lines):

diff -r da1b913358fc -r 7b03a7f09a12 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Thu Feb 02 08:12:08 2017 +0000
+++ b/sys/arch/x86/x86/cpu.c    Thu Feb 02 08:57:04 2017 +0000
@@ -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    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
diff -r da1b913358fc -r 7b03a7f09a12 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Thu Feb 02 08:12:08 2017 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Thu Feb 02 08:57:04 2017 +0000
@@ -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 @@
 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.
diff -r da1b913358fc -r 7b03a7f09a12 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Feb 02 08:12:08 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Feb 02 08:57:04 2017 +0000
@@ -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 @@
 /*
  * 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
 
 /*
diff -r da1b913358fc -r 7b03a7f09a12 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Thu Feb 02 08:12:08 2017 +0000
+++ b/sys/arch/xen/x86/cpu.c    Thu Feb 02 08:57:04 2017 +0000
@@ -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 *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
diff -r da1b913358fc -r 7b03a7f09a12 sys/arch/xen/x86/x86_xpmap.c
--- a/sys/arch/xen/x86/x86_xpmap.c      Thu Feb 02 08:12:08 2017 +0000
+++ b/sys/arch/xen/x86/x86_xpmap.c      Thu Feb 02 08:57:04 2017 +0000
@@ -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@localhost>
@@ -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 @@
 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);
 



Home | Main Index | Thread Index | Old Index