Remove a redundant flag variable.

Use the object pointer itself to determine whether the object is locked.
No functional change intended.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D19215
This commit is contained in:
markj 2019-02-17 16:35:19 +00:00
parent 3740d94caf
commit 88d649090e

View File

@ -695,10 +695,9 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall)
vm_page_t m, marker;
int act_delta, error, numpagedout, queue, starting_target;
int vnodes_skipped;
bool obj_locked, pageout_ok;
bool pageout_ok;
mtx = NULL;
obj_locked = false;
object = NULL;
starting_target = launder;
vnodes_skipped = 0;
@ -760,22 +759,16 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall)
}
if (object != m->object) {
if (obj_locked) {
if (object != NULL)
VM_OBJECT_WUNLOCK(object);
obj_locked = false;
}
object = m->object;
}
if (!obj_locked) {
if (!VM_OBJECT_TRYWLOCK(object)) {
mtx_unlock(mtx);
/* Depends on type-stability. */
VM_OBJECT_WLOCK(object);
obj_locked = true;
mtx_lock(mtx);
goto recheck;
} else
obj_locked = true;
}
}
if (vm_page_busied(m))
@ -897,17 +890,13 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall)
vnodes_skipped++;
}
mtx = NULL;
obj_locked = false;
object = NULL;
}
}
if (mtx != NULL) {
if (mtx != NULL)
mtx_unlock(mtx);
mtx = NULL;
}
if (obj_locked) {
if (object != NULL)
VM_OBJECT_WUNLOCK(object);
obj_locked = false;
}
vm_pagequeue_lock(pq);
vm_pageout_end_scan(&ss);
vm_pagequeue_unlock(pq);
@ -1368,7 +1357,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
vm_object_t object;
int act_delta, addl_page_shortage, deficit, page_shortage;
int starting_page_shortage;
bool obj_locked;
/*
* The addl_page_shortage is an estimate of the number of temporarily
@ -1388,7 +1376,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
starting_page_shortage = page_shortage = shortage + deficit;
mtx = NULL;
obj_locked = false;
object = NULL;
vm_batchqueue_init(&rq);
@ -1446,22 +1433,16 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
}
if (object != m->object) {
if (obj_locked) {
if (object != NULL)
VM_OBJECT_WUNLOCK(object);
obj_locked = false;
}
object = m->object;
}
if (!obj_locked) {
if (!VM_OBJECT_TRYWLOCK(object)) {
mtx_unlock(mtx);
/* Depends on type-stability. */
VM_OBJECT_WLOCK(object);
obj_locked = true;
mtx_lock(mtx);
goto recheck;
} else
obj_locked = true;
}
}
if (vm_page_busied(m)) {
@ -1563,14 +1544,10 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
reinsert:
vm_pageout_reinsert_inactive(&ss, &rq, m);
}
if (mtx != NULL) {
if (mtx != NULL)
mtx_unlock(mtx);
mtx = NULL;
}
if (obj_locked) {
if (object != NULL)
VM_OBJECT_WUNLOCK(object);
obj_locked = false;
}
vm_pageout_reinsert_inactive(&ss, &rq, NULL);
vm_pageout_reinsert_inactive(&ss, &ss.bq, NULL);
vm_pagequeue_lock(pq);