Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2013 19:02:37 +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: r250748 - head/sys/vm
Message-ID:  <201305171902.r4HJ2bHl078459@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Fri May 17 19:02:36 2013
New Revision: 250748
URL: http://svnweb.freebsd.org/changeset/base/250748

Log:
  Relax the object locking in vm_fault_prefault().  A read lock suffices.
  
  Reviewed by:	attilio
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Fri May 17 18:59:00 2013	(r250747)
+++ head/sys/vm/vm_fault.c	Fri May 17 19:02:36 2013	(r250748)
@@ -1044,28 +1044,28 @@ vm_fault_prefault(pmap_t pmap, vm_offset
 
 		pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT;
 		lobject = object;
-		VM_OBJECT_WLOCK(lobject);
+		VM_OBJECT_RLOCK(lobject);
 		while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
 		    lobject->type == OBJT_DEFAULT &&
 		    (backing_object = lobject->backing_object) != NULL) {
 			KASSERT((lobject->backing_object_offset & PAGE_MASK) ==
 			    0, ("vm_fault_prefault: unaligned object offset"));
 			pindex += lobject->backing_object_offset >> PAGE_SHIFT;
-			VM_OBJECT_WLOCK(backing_object);
-			VM_OBJECT_WUNLOCK(lobject);
+			VM_OBJECT_RLOCK(backing_object);
+			VM_OBJECT_RUNLOCK(lobject);
 			lobject = backing_object;
 		}
 		/*
 		 * give-up when a page is not in memory
 		 */
 		if (m == NULL) {
-			VM_OBJECT_WUNLOCK(lobject);
+			VM_OBJECT_RUNLOCK(lobject);
 			break;
 		}
 		if (m->valid == VM_PAGE_BITS_ALL &&
 		    (m->flags & PG_FICTITIOUS) == 0)
 			pmap_enter_quick(pmap, addr, m, entry->protection);
-		VM_OBJECT_WUNLOCK(lobject);
+		VM_OBJECT_RUNLOCK(lobject);
 	}
 }
 



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