* does not have any data.
*/
- if (m->absent || m->error || m->restart)
- return(MEMORY_OBJECT_LOCK_RESULT_DONE);
+ if (m->absent || m->error || m->restart) {
+ if(m->error && should_flush) {
+ /* dump the page, pager wants us to */
+ /* clean it up and there is no */
+ /* relevant data to return */
+ if(m->wire_count == 0) {
+ VM_PAGE_FREE(m);
+ return(MEMORY_OBJECT_LOCK_RESULT_DONE);
+ }
+ } else {
+ return(MEMORY_OBJECT_LOCK_RESULT_DONE);
+ }
+ }
assert(!m->fictitious);
continue;
}
- PAGE_ASSERT_WAIT(m, THREAD_UNINT);
- vm_object_unlock(object);
- thread_block((void (*)(void))0);
- vm_object_lock(object);
+ PAGE_SLEEP(object, m, THREAD_UNINT);
continue;
case MEMORY_OBJECT_LOCK_RESULT_MUST_CLEAN:
m->busy = FALSE;
holding_page = VM_PAGE_NULL;
if(m->cleaning) {
- PAGE_ASSERT_WAIT(m, THREAD_UNINT);
- vm_object_unlock(object);
- thread_block((void (*)(void))0);
+ PAGE_SLEEP(object, m, THREAD_UNINT);
continue;
}
if(!pending_pageout) {
mutex_lock(&memory_manager_default_lock);
current_manager = memory_manager_default;
while (current_manager == MEMORY_OBJECT_DEFAULT_NULL) {
- thread_sleep_mutex((event_t) &memory_manager_default,
- &memory_manager_default_lock, THREAD_UNINT);
- mutex_lock(&memory_manager_default_lock);
+ wait_result_t res;
+
+ res = thread_sleep_mutex((event_t) &memory_manager_default,
+ &memory_manager_default_lock,
+ THREAD_UNINT);
+ assert(res == THREAD_AWAKENED);
current_manager = memory_manager_default;
}
memory_object_default_reference(current_manager);
}
VM_PAGE_QUEUES_REMOVE(m);
- queue_enter_first(&vm_page_queue_inactive, m, vm_page_t, pageq);
+ if(m->zero_fill) {
+ queue_enter_first(
+ &vm_page_queue_zf,
+ m, vm_page_t, pageq);
+ } else {
+ queue_enter_first(
+ &vm_page_queue_inactive,
+ m, vm_page_t, pageq);
+ }
m->inactive = TRUE;
if (!m->fictitious)
(ops & UPL_POP_BUSY)) || (ops & UPL_POP_DUMP))) {
/* someone else is playing with the page, we will */
/* have to wait */
- PAGE_ASSERT_WAIT(dst_page, THREAD_UNINT);
- vm_object_unlock(object);
- thread_block((void(*)(void))0);
- vm_object_lock(object);
+ PAGE_SLEEP(object, dst_page, THREAD_UNINT);
continue;
}