svn commit: r355216 - head/sys/vm
Jeff Roberson
jeff at FreeBSD.org
Fri Nov 29 19:49:21 UTC 2019
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;
More information about the svn-src-all
mailing list