Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2012 19:13:57 +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-9@freebsd.org
Subject:   svn commit: r236481 - stable/9/sys/vm
Message-ID:  <201206021913.q52JDvqC008511@svn.freebsd.org>

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

Log:
  MFC r235829: vm_pager_object_lookup: small performance optimization

Modified:
  stable/9/sys/vm/vm_pager.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/vm/vm_pager.c
==============================================================================
--- stable/9/sys/vm/vm_pager.c	Sat Jun  2 19:11:47 2012	(r236480)
+++ stable/9/sys/vm/vm_pager.c	Sat Jun  2 19:13:56 2012	(r236481)
@@ -270,14 +270,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?201206021913.q52JDvqC008511>