Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Nov 2019 19:49:20 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355216 - head/sys/vm
Message-ID:  <201911291949.xATJnK5f089689@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Fri Nov 29 19:49:20 2019
New Revision: 355216
URL: https://svnweb.freebsd.org/changeset/base/355216

Log:
  Avoid acquiring the object lock if color is already set.  It can not be
  unset until the object is recycled so this check is stable.  Now that we
  can acquire the ref without a lock it is not necessary to group these
  operations and we can avoid it entirely in many cases.
  
  Reviewed by:	kib, markj
  Differential Revision:	https://reviews.freebsd.org/D22565

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Fri Nov 29 19:47:40 2019	(r355215)
+++ head/sys/vm/vm_mmap.c	Fri Nov 29 19:49:20 2019	(r355216)
@@ -1325,12 +1325,14 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
 	} else {
 		KASSERT(obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP,
 		    ("wrong object type"));
-		VM_OBJECT_WLOCK(obj);
-		vm_object_reference_locked(obj);
+		vm_object_reference(obj);
 #if VM_NRESERVLEVEL > 0
-		vm_object_color(obj, 0);
+		if ((obj->flags & OBJ_COLORED) == 0) {
+			VM_OBJECT_WLOCK(obj);
+			vm_object_color(obj, 0);
+			VM_OBJECT_WUNLOCK(obj);
+		}
 #endif
-		VM_OBJECT_WUNLOCK(obj);
 	}
 	*objp = obj;
 	*flagsp = flags;



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