Date: Sat, 18 Mar 2017 05:53:09 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315475 - in stable/11/sys: kern vm Message-ID: <201703180553.v2I5r9mm059535@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Sat Mar 18 05:53:09 2017 New Revision: 315475 URL: https://svnweb.freebsd.org/changeset/base/315475 Log: MFC r315318 Relax the locking requirements for vm_object_page_noreuse(). While reviewing all uses of OFF_TO_IDX(), I observed that vm_object_page_noreuse() is requiring an exclusive lock on the object when, in fact, a shared lock suffices. Modified: stable/11/sys/kern/vfs_default.c stable/11/sys/vm/vm_object.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_default.c ============================================================================== --- stable/11/sys/kern/vfs_default.c Sat Mar 18 05:48:26 2017 (r315474) +++ stable/11/sys/kern/vfs_default.c Sat Mar 18 05:53:09 2017 (r315475) @@ -1100,10 +1100,10 @@ vop_stdadvise(struct vop_advise_args *ap if (vp->v_object != NULL) { start = trunc_page(ap->a_start); end = round_page(ap->a_end); - VM_OBJECT_WLOCK(vp->v_object); + VM_OBJECT_RLOCK(vp->v_object); vm_object_page_noreuse(vp->v_object, OFF_TO_IDX(start), OFF_TO_IDX(end)); - VM_OBJECT_WUNLOCK(vp->v_object); + VM_OBJECT_RUNLOCK(vp->v_object); } bo = &vp->v_bufobj; Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Sat Mar 18 05:48:26 2017 (r315474) +++ stable/11/sys/vm/vm_object.c Sat Mar 18 05:53:09 2017 (r315475) @@ -1977,7 +1977,7 @@ vm_object_page_noreuse(vm_object_t objec struct mtx *mtx, *new_mtx; vm_page_t p, next; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); KASSERT((object->flags & (OBJ_FICTITIOUS | OBJ_UNMANAGED)) == 0, ("vm_object_page_noreuse: illegal object %p", object)); if (object->resident_page_count == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703180553.v2I5r9mm059535>