Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2012 19:21:35 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r236485 - stable/8/sys/vm
Message-ID:  <201206021921.q52JLZCn009041@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sat Jun  2 19:21:34 2012
New Revision: 236485
URL: http://svn.freebsd.org/changeset/base/236485

Log:
  MFC r235829: vm_pager_object_lookup: small performance optimization

Modified:
  stable/8/sys/vm/vm_pager.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/vm/vm_pager.c
==============================================================================
--- stable/8/sys/vm/vm_pager.c	Sat Jun  2 19:16:09 2012	(r236484)
+++ stable/8/sys/vm/vm_pager.c	Sat Jun  2 19:21:34 2012	(r236485)
@@ -272,14 +272,15 @@ vm_pager_object_lookup(struct pagerlst *
 	vm_object_t object;
 
 	TAILQ_FOREACH(object, pg_list, pager_object_list) {
-		VM_OBJECT_LOCK(object);
-		if (object->handle == handle &&
-		    (object->flags & OBJ_DEAD) == 0) {
-			vm_object_reference_locked(object);
+		if (object->handle == handle) {
+			VM_OBJECT_LOCK(object);
+			if ((object->flags & OBJ_DEAD) == 0) {
+				vm_object_reference_locked(object);
+				VM_OBJECT_UNLOCK(object);
+				break;
+			}
 			VM_OBJECT_UNLOCK(object);
-			break;
 		}
-		VM_OBJECT_UNLOCK(object);
 	}
 	return (object);
 }



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