diff options
author | alc <alc@FreeBSD.org> | 2003-03-01 19:16:32 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-03-01 19:16:32 +0000 |
commit | 1d9375957c5801dcf8c85de494ac52f8400b1aa9 (patch) | |
tree | 7ac4a1e7deb2783537c14d1a7259fd7ed9f52450 /sys/vm | |
parent | 878cb0e757feb4968f450ca5aa7832a661be1dea (diff) | |
download | FreeBSD-src-1d9375957c5801dcf8c85de494ac52f8400b1aa9.zip FreeBSD-src-1d9375957c5801dcf8c85de494ac52f8400b1aa9.tar.gz |
Teach vm_page_sleep_if_busy() to release the vm_object lock before sleeping.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_page.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index cbdcc4c..0f0ef50 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -427,11 +427,20 @@ vm_page_free_zero(vm_page_t m) int vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg) { + int is_object_locked; mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) { vm_page_flag_set(m, PG_WANTED | PG_REFERENCED); + /* + * Remove mtx_owned() after vm_object locking is finished. + */ + if ((is_object_locked = m->object != NULL && + mtx_owned(&m->object->mtx))) + mtx_unlock(&m->object->mtx); msleep(m, &vm_page_queue_mtx, PDROP | PVM, msg, 0); + if (is_object_locked) + mtx_lock(&m->object->mtx); return (TRUE); } return (FALSE); |