From owner-svn-src-head@freebsd.org Wed Mar 15 17:43:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22668D0D0A2; Wed, 15 Mar 2017 17:43:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E36B9CF1; Wed, 15 Mar 2017 17:43:46 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2FHhjBW066659; Wed, 15 Mar 2017 17:43:45 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2FHhjLn066656; Wed, 15 Mar 2017 17:43:45 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201703151743.v2FHhjLn066656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 15 Mar 2017 17:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315318 - in head/sys: kern vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Mar 2017 17:43:47 -0000 Author: alc Date: Wed Mar 15 17:43:45 2017 New Revision: 315318 URL: https://svnweb.freebsd.org/changeset/base/315318 Log: 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. Reviewed by: kib, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D10011 Modified: head/sys/kern/vfs_default.c head/sys/vm/vm_object.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Wed Mar 15 17:26:19 2017 (r315317) +++ head/sys/kern/vfs_default.c Wed Mar 15 17:43:45 2017 (r315318) @@ -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: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Mar 15 17:26:19 2017 (r315317) +++ head/sys/vm/vm_object.c Wed Mar 15 17:43:45 2017 (r315318) @@ -1978,7 +1978,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)