Module Name:    src
Committed By:   skrll
Date:           Sun Aug  9 06:26:49 UTC 2020

Modified Files:
        src/sys/arch/mips/include: cpu.h
        src/sys/arch/mips/mips: cpu_subr.c
        src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Don't kcpuset_clone every pmap_tlb_shootdown_bystanders.  Instead allocate
a kcpuset_t per cpu_info and use that.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.33 -r1.34 src/sys/uvm/pmap/pmap_tlb.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.129 src/sys/arch/mips/include/cpu.h:1.130
--- src/sys/arch/mips/include/cpu.h:1.129	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/cpu.h	Sun Aug  9 06:26:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.129 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: cpu.h,v 1.130 2020/08/09 06:26:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -151,6 +151,7 @@ struct cpu_info {
 #define	CPUF_RUNNING	0x04		/* CPU is running */
 #define	CPUF_PAUSED	0x08		/* CPU is paused */
 #define	CPUF_USERPMAP	0x20		/* CPU has a user pmap activated */
+	kcpuset_t *ci_shootdowncpus;
 	kcpuset_t *ci_multicastcpus;
 	kcpuset_t *ci_watchcpus;
 	kcpuset_t *ci_ddbcpus;

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.56 src/sys/arch/mips/mips/cpu_subr.c:1.57
--- src/sys/arch/mips/mips/cpu_subr.c:1.56	Tue Jul 21 06:01:10 2020
+++ src/sys/arch/mips/mips/cpu_subr.c	Sun Aug  9 06:26:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.56 2020/07/21 06:01:10 simonb Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.57 2020/08/09 06:26:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.56 2020/07/21 06:01:10 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.57 2020/08/09 06:26:49 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -291,6 +291,7 @@ cpu_attach_common(device_t self, struct 
 	 */
 	ipi_init(ci);
 
+	kcpuset_create(&ci->ci_shootdowncpus, true);
 	kcpuset_create(&ci->ci_multicastcpus, true);
 	kcpuset_create(&ci->ci_watchcpus, true);
 	kcpuset_create(&ci->ci_ddbcpus, true);

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.33 src/sys/uvm/pmap/pmap_tlb.c:1.34
--- src/sys/uvm/pmap/pmap_tlb.c:1.33	Tue Apr 14 05:43:57 2020
+++ src/sys/uvm/pmap/pmap_tlb.c	Sun Aug  9 06:26:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.33 2020/04/14 05:43:57 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.34 2020/08/09 06:26:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.33 2020/04/14 05:43:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.34 2020/08/09 06:26:49 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -643,8 +643,9 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, "pm %#jx", (uintptr_t)pm, 0, 0, 0);
 
-	kcpuset_t *pm_active;
-	kcpuset_clone(&pm_active, pm->pm_active);
+	const struct cpu_info * const ci = curcpu();
+	kcpuset_t *pm_active = ci->ci_shootdowncpus;
+	kcpuset_copy(pm_active, pm->pm_active);
 	kcpuset_remove(pm_active, cpu_tlb_info(curcpu())->ti_kcpuset);
 	const bool kernel_p = (pm == pmap_kernel());
 	bool ipi_sent = false;
@@ -719,8 +720,6 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 		TLBINFO_UNLOCK(ti);
 	}
 
-	kcpuset_destroy(pm_active);
-
 	UVMHIST_LOG(maphist, " <-- done (ipi_sent=%jd)", ipi_sent, 0, 0, 0);
 
 	return ipi_sent;

Reply via email to