Module Name:    src
Committed By:   ad
Date:           Wed May 27 19:15:08 UTC 2020

Modified Files:
        src/sys/arch/x86/x86: svs.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/svs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.35 src/sys/arch/x86/x86/svs.c:1.36
--- src/sys/arch/x86/x86/svs.c:1.35	Sat May  2 11:37:17 2020
+++ src/sys/arch/x86/x86/svs.c	Wed May 27 19:15:08 2020
@@ -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 @@ svs_pmap_sync(struct pmap *pmap, int ind
 	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);
 

Reply via email to