- /*
- * Do a wakeup here in case the following
- * operations block.
- */
- thread_wakeup((int) &cnt.v_free_count);
-
- /*
- * If there is no pager for the page,
- * use the default pager. If there's
- * no place to put the page at the
- * moment, leave it in the laundry and
- * hope that there will be paging space
- * later.
- */
-
- if ((pager = object->pager) == NULL) {
- pager = vm_pager_allocate(PG_DFLT,
- (caddr_t)0,
- object->size,
- VM_PROT_ALL);
- if (pager != NULL) {
- vm_object_setpager(object,
- pager, 0, FALSE);
- }
- }
- pageout_status = pager ?
- vm_pager_put(pager, m, FALSE) :
- VM_PAGER_FAIL;
- vm_object_lock(object);
- vm_page_lock_queues();
- next = (vm_page_t) queue_next(&m->pageq);
-
- switch (pageout_status) {
- case VM_PAGER_OK:
- case VM_PAGER_PEND:
- m->laundry = FALSE;
- break;
- case VM_PAGER_BAD:
- /*
- * Page outside of range of object.
- * Right now we essentially lose the
- * changes by pretending it worked.
- * XXX dubious, what should we do?
- */
- m->laundry = FALSE;
- m->clean = TRUE;
- pmap_clear_modify(VM_PAGE_TO_PHYS(m));
- break;
- case VM_PAGER_FAIL:
- case VM_PAGER_ERROR:
- /*
- * If page couldn't be paged out, then
- * reactivate the page so it doesn't
- * clog the inactive list. (We will
- * try paging out it again later).
- */
- vm_page_activate(m);
- break;
- }
-
- pmap_clear_reference(VM_PAGE_TO_PHYS(m));
-
- /*
- * If the operation is still going, leave
- * the page busy to block all other accesses.
- * Also, leave the paging in progress
- * indicator set so that we don't attempt an
- * object collapse.
- */
- if (pageout_status != VM_PAGER_PEND) {
- m->busy = FALSE;
- PAGE_WAKEUP(m);
- object->paging_in_progress--;
- }
- thread_wakeup((int) object);
- vm_object_unlock(object);
- m = next;
- }
- else
- m = (vm_page_t) queue_next(&m->pageq);
+ /*
+ * If there is no pager for the page, use the default pager.
+ * If there is no place to put the page at the moment,
+ * leave it in the laundry and hope that there will be
+ * paging space later.
+ */
+ if ((pager = object->pager) == NULL) {
+ pager = vm_pager_allocate(PG_DFLT, (caddr_t)0,
+ object->size, VM_PROT_ALL);
+ if (pager != NULL)
+ vm_object_setpager(object, pager, 0, FALSE);
+ }
+ pageout_status = pager ?
+ vm_pager_put(pager, m, FALSE) : VM_PAGER_FAIL;
+ vm_object_lock(object);
+ vm_page_lock_queues();
+ next = (vm_page_t) queue_next(&m->pageq);
+
+ switch (pageout_status) {
+ case VM_PAGER_OK:
+ case VM_PAGER_PEND:
+ m->flags &= ~PG_LAUNDRY;
+ break;
+ case VM_PAGER_BAD:
+ /*
+ * Page outside of range of object. Right now we
+ * essentially lose the changes by pretending it
+ * worked.
+ *
+ * XXX dubious, what should we do?
+ */
+ m->flags &= ~PG_LAUNDRY;
+ m->flags |= PG_CLEAN;
+ pmap_clear_modify(VM_PAGE_TO_PHYS(m));
+ break;
+ case VM_PAGER_FAIL:
+ case VM_PAGER_ERROR:
+ /*
+ * If page couldn't be paged out, then reactivate
+ * the page so it doesn't clog the inactive list.
+ * (We will try paging out it again later).
+ */
+ vm_page_activate(m);
+ break;
+ }
+
+ pmap_clear_reference(VM_PAGE_TO_PHYS(m));
+
+ /*
+ * If the operation is still going, leave the page busy
+ * to block all other accesses. Also, leave the paging
+ * in progress indicator set so that we don't attempt an
+ * object collapse.
+ */
+ if (pageout_status != VM_PAGER_PEND) {
+ m->flags &= ~PG_BUSY;
+ PAGE_WAKEUP(m);
+ object->paging_in_progress--;