Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 svs_pmap_sync(): Fast-path the curcpu case....



details:   https://anonhg.NetBSD.org/src/rev/77bdb8021403
branches:  trunk
changeset: 1010525:77bdb8021403
user:      ad <ad%NetBSD.org@localhost>
date:      Wed May 27 19:15:08 2020 +0000

description:
svs_pmap_sync(): Fast-path the curcpu case.  Could be improved further
with a kcpuset iterator thing.

diffstat:

 sys/arch/x86/x86/svs.c |  18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 3a0922739a1e -r 77bdb8021403 sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c    Wed May 27 18:55:36 2020 +0000
+++ b/sys/arch/x86/x86/svs.c    Wed May 27 19:15:08 2020 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: svs.c,v 1.35 2020/05/02 11:37:17 maxv Exp $    */
+/*     $NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $      */
 
 /*
- * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.35 2020/05/02 11:37:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $");
 
 #include "opt_svs.h"
 #include "opt_user_ldt.h"
@@ -575,6 +575,18 @@
        KASSERT(kpreempt_disabled());
        KASSERT(index < PDIR_SLOT_USERLIM);
 
+       ci = curcpu();
+       cid = cpu_index(ci);
+
+       mutex_enter(&ci->ci_svs_mtx);
+       KASSERT(kcpuset_isset(pmap->pm_kernel_cpus, cid));
+       ci->ci_svs_updir[index] = pmap->pm_pdir[index];
+       mutex_exit(&ci->ci_svs_mtx);
+
+       if (!kcpuset_isotherset(pmap->pm_kernel_cpus, cid)) {
+               return;
+       }
+
        for (CPU_INFO_FOREACH(cii, ci)) {
                cid = cpu_index(ci);
 



Home | Main Index | Thread Index | Old Index