Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2017 17:43:45 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315318 - in head/sys: kern vm
Message-ID:  <201703151743.v2FHhjLn066656@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703151743.v2FHhjLn066656>