vm_pager_object_lookup: small performance optimization
do not needlessly lock an object if its handle doesn't match Reviewed by: kib, alc MFC after: 1 week
This commit is contained in:
parent
807aad636f
commit
b6062382be
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235829
@ -271,14 +271,15 @@ vm_pager_object_lookup(struct pagerlst *pg_list, void *handle)
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user