Assert that the vm object is locked on entry to vm_page_sleep_if_busy();
remove some unneeded code.
This commit is contained in:
parent
6e908e6c88
commit
0a1de6d552
@ -424,9 +424,9 @@ int
|
|||||||
vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg)
|
vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg)
|
||||||
{
|
{
|
||||||
vm_object_t object;
|
vm_object_t object;
|
||||||
int is_object_locked;
|
|
||||||
|
|
||||||
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
|
||||||
|
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
|
||||||
if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) {
|
if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) {
|
||||||
vm_page_flag_set(m, PG_WANTED | PG_REFERENCED);
|
vm_page_flag_set(m, PG_WANTED | PG_REFERENCED);
|
||||||
/*
|
/*
|
||||||
@ -435,16 +435,11 @@ vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg)
|
|||||||
* lock, we will assume we hold a reference to the object
|
* lock, we will assume we hold a reference to the object
|
||||||
* such that even if m->object changes, we can re-lock
|
* such that even if m->object changes, we can re-lock
|
||||||
* it.
|
* it.
|
||||||
*
|
|
||||||
* Remove mtx_owned() after vm_object locking is finished.
|
|
||||||
*/
|
*/
|
||||||
object = m->object;
|
object = m->object;
|
||||||
if ((is_object_locked = object != NULL &&
|
VM_OBJECT_UNLOCK(object);
|
||||||
mtx_owned(&object->mtx)))
|
|
||||||
mtx_unlock(&object->mtx);
|
|
||||||
msleep(m, &vm_page_queue_mtx, PDROP | PVM, msg, 0);
|
msleep(m, &vm_page_queue_mtx, PDROP | PVM, msg, 0);
|
||||||
if (is_object_locked)
|
VM_OBJECT_LOCK(object);
|
||||||
mtx_lock(&object->mtx);
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user