summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2014-09-03 06:47:05 +0000
committeralc <alc@FreeBSD.org>2014-09-03 06:47:05 +0000
commit3295e3612efb35e29114d5450a47113e3becece1 (patch)
tree3fdae442f8766357fd21e486ab16ca7523be61b6 /sys/vm
parent63a3fa9dd01a9f60382de27d62550a7fdcfb0659 (diff)
downloadFreeBSD-src-3295e3612efb35e29114d5450a47113e3becece1.zip
FreeBSD-src-3295e3612efb35e29114d5450a47113e3becece1.tar.gz
MFC r270666
Back in the days when the kernel was single threaded, testing "vm_paging_target() > 0" was a reasonable way of determining if the inactive queue scan met its target. However, now that other threads can be allocating pages while the inactive queue scan is running, it's an unreliable method. The effect of it being unreliable is that we can start swapping out processes when we didn't intend to. This issue has existed since the kernel was multithreaded, but the changes to the inactive queue target in 10.0-RELEASE have made its effects visible. This change introduces a more direct method for determining if the inactive queue scan met its target that is not affected by the actions of other threads.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_pageout.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 9ccb606..33ead33 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1308,6 +1308,23 @@ relock_queues:
}
vm_pagequeue_unlock(pq);
+#if !defined(NO_SWAPPING)
+ /*
+ * Wakeup the swapout daemon if we didn't cache or free the targeted
+ * number of pages.
+ */
+ if (vm_swap_enabled && page_shortage > 0)
+ vm_req_vmdaemon(VM_SWAP_NORMAL);
+#endif
+
+ /*
+ * Wakeup the sync daemon if we skipped a vnode in a writeable object
+ * and we didn't cache or free enough pages.
+ */
+ if (vnodes_skipped > 0 && page_shortage > vm_cnt.v_free_target -
+ vm_cnt.v_free_min)
+ (void)speedup_syncer();
+
/*
* Compute the number of pages we want to try to move from the
* active queue to the inactive queue.
@@ -1418,20 +1435,6 @@ relock_queues:
}
}
#endif
-
- /*
- * If we didn't get enough free pages, and we have skipped a vnode
- * in a writeable object, wakeup the sync daemon. And kick swapout
- * if we did not get enough free pages.
- */
- if (vm_paging_target() > 0) {
- if (vnodes_skipped && vm_page_count_min())
- (void) speedup_syncer();
-#if !defined(NO_SWAPPING)
- if (vm_swap_enabled && vm_page_count_target())
- vm_req_vmdaemon(VM_SWAP_NORMAL);
-#endif
- }
/*
* If we are critically low on one of RAM or swap and low on
OpenPOWER on IntegriCloud