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@
-/* $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 $ */
/*
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;