Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm/pmap sys: Use membar_release/acquire around referenc...
details: https://anonhg.NetBSD.org/src/rev/114adf1cc9f0
branches: trunk
changeset: 365150:114adf1cc9f0
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Apr 09 23:38:31 2022 +0000
description:
sys: Use membar_release/acquire around reference drop.
This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 8 ++++----
sys/arch/alpha/alpha/pmap.c | 8 ++++----
sys/arch/arm/arm32/pmap.c | 8 ++++----
sys/arch/hppa/hppa/pmap.c | 8 ++++----
sys/arch/ia64/ia64/pmap.c | 10 +++++-----
sys/arch/powerpc/oea/pmap.c | 8 ++++----
sys/arch/sparc/sparc/pmap.c | 8 ++++----
sys/arch/sparc64/sparc64/pmap.c | 8 ++++----
sys/dev/hyperv/vmbus.c | 8 ++++----
sys/dev/marvell/mvxpsec.c | 6 +++---
sys/dev/scsipi/atapiconf.c | 8 ++++----
sys/dev/scsipi/scsiconf.c | 8 ++++----
sys/dev/scsipi/scsipi_base.c | 8 ++++----
sys/external/bsd/drm2/linux/linux_stop_machine.c | 8 ++++----
sys/kern/kern_auth.c | 8 ++++----
sys/kern/kern_exec.c | 8 ++++----
sys/kern/kern_mutex_obj.c | 8 ++++----
sys/kern/kern_resource.c | 8 ++++----
sys/kern/kern_rwlock_obj.c | 8 ++++----
sys/kern/kern_sig.c | 8 ++++----
sys/kern/subr_kcpuset.c | 8 ++++----
sys/kern/sys_futex.c | 8 ++++----
sys/kern/uipc_mbuf.c | 8 ++++----
sys/kern/vfs_cwd.c | 8 ++++----
sys/kern/vfs_mount.c | 8 ++++----
sys/kern/vfs_vnode.c | 18 +++++++++---------
sys/kern/vfs_wapbl.c | 8 ++++----
sys/net/if.c | 8 ++++----
sys/net/npf/npf_nat.c | 6 +++---
sys/net/npf/npf_rproc.c | 6 +++---
sys/net/npf/npf_tableset.c | 6 +++---
sys/uvm/pmap/pmap.c | 8 ++++----
sys/uvm/uvm_aobj.c | 8 ++++----
sys/uvm/uvm_map.c | 8 ++++----
34 files changed, 138 insertions(+), 138 deletions(-)
diffs (truncated from 1117 to 300 lines):
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.132 2022/04/02 11:16:06 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.133 2022/04/09 23:38:31 riastradh Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.132 2022/04/02 11:16:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.133 2022/04/09 23:38:31 riastradh Exp $");
#include "opt_arm_debug.h"
#include "opt_cpuoptions.h"
@@ -1651,11 +1651,11 @@
if (pm == pmap_kernel())
panic("cannot destroy kernel pmap");
- membar_exit();
+ membar_release();
refcnt = atomic_dec_uint_nv(&pm->pm_refcnt);
if (refcnt > 0)
return;
- membar_enter();
+ membar_acquire();
KASSERT(LIST_EMPTY(&pm->pm_pvlist));
pmap_tlb_asid_release_all(pm);
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.307 2022/04/09 23:38:31 riastradh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.307 2022/04/09 23:38:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1659,11 +1659,11 @@
printf("pmap_destroy(%p)\n", pmap);
#endif
- PMAP_MP(membar_exit());
+ PMAP_MP(membar_release());
KASSERT(atomic_load_relaxed(&pmap->pm_count) > 0);
if (atomic_dec_uint_nv(&pmap->pm_count) > 0)
return;
- PMAP_MP(membar_enter());
+ PMAP_MP(membar_acquire());
pt_entry_t *lev1map = pmap_lev1map(pmap);
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.435 2022/04/02 11:16:07 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.435 2022/04/02 11:16:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -5385,7 +5385,7 @@
/*
* Drop reference count
*/
- membar_exit();
+ membar_release();
if (atomic_dec_uint_nv(&pm->pm_refs) > 0) {
#ifndef ARM_MMU_EXTENDED
if (pmap_is_current(pm)) {
@@ -5396,7 +5396,7 @@
#endif
return;
}
- membar_enter();
+ membar_acquire();
/*
* reference count is zero, free pmap resources and then free pmap.
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/hppa/hppa/pmap.c
--- a/sys/arch/hppa/hppa/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/hppa/hppa/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.115 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.116 2022/04/09 23:38:32 riastradh Exp $ */
/*-
* Copyright (c) 2001, 2002, 2020 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.115 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.116 2022/04/09 23:38:32 riastradh Exp $");
#include "opt_cputype.h"
@@ -1249,10 +1249,10 @@
off_t off;
#endif
- membar_exit();
+ membar_release();
if (atomic_dec_uint_nv(&pmap->pm_obj.uo_refs) > 0)
return;
- membar_enter();
+ membar_acquire();
#ifdef DIAGNOSTIC
uvm_page_array_init(&a, &pmap->pm_obj, 0);
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/ia64/ia64/pmap.c
--- a/sys/arch/ia64/ia64/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/ia64/ia64/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.41 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.42 2022/04/09 23:38:32 riastradh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.42 2022/04/09 23:38:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -1516,11 +1516,11 @@
UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
UVMHIST_LOG(maphist, "(pm=%p)", pmap, 0, 0, 0);
-
- membar_exit();
+
+ membar_release();
if (atomic_dec_64_nv(&pmap->pm_refcount) > 0)
return;
- membar_enter();
+ membar_acquire();
KASSERT(pmap->pm_stats.resident_count == 0);
KASSERT(pmap->pm_stats.wired_count == 0);
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/powerpc/oea/pmap.c
--- a/sys/arch/powerpc/oea/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/powerpc/oea/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.112 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $");
#define PMAP_NOOPNAMES
@@ -1230,9 +1230,9 @@
void
pmap_destroy(pmap_t pm)
{
- membar_exit();
+ membar_release();
if (atomic_dec_uint_nv(&pm->pm_refs) == 0) {
- membar_enter();
+ membar_acquire();
pmap_release(pm);
pool_put(&pmap_pool, pm);
}
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/sparc/sparc/pmap.c
--- a/sys/arch/sparc/sparc/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/sparc/sparc/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.376 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.377 2022/04/09 23:38:32 riastradh Exp $ */
/*
* Copyright (c) 1996
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.376 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.377 2022/04/09 23:38:32 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -4465,9 +4465,9 @@
{
DPRINTF(PDB_DESTROY, "pmap_destroy[%d](%p)", cpu_number(), pm);
- membar_exit();
+ membar_release();
if (atomic_dec_uint_nv(&pm->pm_refcount) == 0) {
- membar_enter();
+ membar_acquire();
pmap_quiet_check(pm);
pool_cache_put(&pmap_cache, pm);
}
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.315 2022/04/06 22:48:21 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.316 2022/04/09 23:38:32 riastradh Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.315 2022/04/06 22:48:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.316 2022/04/09 23:38:32 riastradh Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -1510,11 +1510,11 @@
#endif
struct vm_page *pg;
- membar_exit();
+ membar_release();
if ((int)atomic_dec_uint_nv(&pm->pm_refs) > 0) {
return;
}
- membar_enter();
+ membar_acquire();
DPRINTF(PDB_DESTROY, ("pmap_destroy: freeing pmap %p\n", pm));
#ifdef MULTIPROCESSOR
CPUSET_CLEAR(pmap_cpus_active);
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/dev/hyperv/vmbus.c
--- a/sys/dev/hyperv/vmbus.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/dev/hyperv/vmbus.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmbus.c,v 1.16 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: vmbus.c,v 1.17 2022/04/09 23:38:32 riastradh Exp $ */
/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.16 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.17 2022/04/09 23:38:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1452,10 +1452,10 @@
KASSERTMSG(ch->ch_refs > 0, "channel%u: invalid refcnt %d",
ch->ch_id, ch->ch_refs);
- membar_exit();
+ membar_release();
refs = atomic_dec_uint_nv(&ch->ch_refs);
if (refs == 0) {
- membar_enter();
+ membar_acquire();
/* Detach the target channel. */
vmbus_devq_enqueue(ch->ch_sc, VMBUS_DEV_TYPE_DETACH, ch);
}
diff -r 3e1df3adc169 -r 114adf1cc9f0 sys/dev/marvell/mvxpsec.c
--- a/sys/dev/marvell/mvxpsec.c Sat Apr 09 23:36:22 2022 +0000
+++ b/sys/dev/marvell/mvxpsec.c Sat Apr 09 23:38:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvxpsec.c,v 1.12 2022/04/06 22:48:09 riastradh Exp $ */
+/* $NetBSD: mvxpsec.c,v 1.13 2022/04/09 23:38:32 riastradh Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
* All rights reserved.
@@ -1551,10 +1551,10 @@
{
uint32_t refs;
Home |
Main Index |
Thread Index |
Old Index