diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-10-23 07:18:45 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-10-23 07:18:45 +0000 |
commit | 2f5049de6cd92220c9a28e372685960b6911d374 (patch) | |
tree | 094b90928388189f8336c886a4f18b9d9f2d0c2d /sys/uvm | |
parent | 87482837236ddd1ef6af71b8678d3b0f89033345 (diff) |
Decrement uobj reference count without KERNEL_LOCK().
Reduce KERNEL_LOCK() contention when tearing down file-backed regions. Here
it is safe to interleave the KERNEL_LOCK() and a rwlock because the former
is released if the latter is contented.
Contention analysed by and ok claudio@, ok kettenis@
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_vnode.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c index 079186cc563..8213f2699a4 100644 --- a/sys/uvm/uvm_vnode.c +++ b/sys/uvm/uvm_vnode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_vnode.c,v 1.133 2024/07/24 12:16:21 mpi Exp $ */ +/* $OpenBSD: uvm_vnode.c,v 1.134 2024/10/23 07:18:44 mpi Exp $ */ /* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */ /* @@ -306,15 +306,14 @@ uvn_detach(struct uvm_object *uobj) struct vnode *vp; int oldflags; - KERNEL_LOCK(); rw_enter(uobj->vmobjlock, RW_WRITE); uobj->uo_refs--; /* drop ref! */ if (uobj->uo_refs) { /* still more refs */ rw_exit(uobj->vmobjlock); - KERNEL_UNLOCK(); return; } + KERNEL_LOCK(); /* get other pointers ... */ uvn = (struct uvm_vnode *) uobj; vp = uvn->u_vnode; |