summaryrefslogtreecommitdiff
path: root/sys/vm/vm_page.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r--sys/vm/vm_page.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 53353e957346..b67929052dd4 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -695,6 +695,39 @@ vm_page_free_zero(vm_page_t m)
}
/*
+ * Unbusy and handle the page queueing for a page from the VOP_GETPAGES()
+ * array which is not the request page.
+ */
+void
+vm_page_readahead_finish(vm_page_t m, int error)
+{
+
+ if (error == 0) {
+ /*
+ * Since the page is not the requested page, whether
+ * it should be activated or deactivated is not
+ * obvious. Empirical results have shown that
+ * deactivating the page is usually the best choice,
+ * unless the page is wanted by another thread.
+ */
+ if (m->oflags & VPO_WANTED) {
+ vm_page_lock(m);
+ vm_page_activate(m);
+ vm_page_unlock(m);
+ } else {
+ vm_page_lock(m);
+ vm_page_deactivate(m);
+ vm_page_unlock(m);
+ }
+ vm_page_wakeup(m);
+ } else {
+ vm_page_lock(m);
+ vm_page_free(m);
+ vm_page_unlock(m);
+ }
+}
+
+/*
* vm_page_sleep:
*
* Sleep and release the page and page queues locks.