[Midnightbsd-cvs] src [8014] trunk/sys/vm/vm_pageout.c: do not requeue held page or page for which locking failed, just leave them alone.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Sep 15 05:02:47 EDT 2016
Revision: 8014
http://svnweb.midnightbsd.org/src/?rev=8014
Author: laffer1
Date: 2016-09-15 05:02:47 -0400 (Thu, 15 Sep 2016)
Log Message:
-----------
do not requeue held page or page for which locking failed, just leave them alone. process the act_count updates for the held pages in the vm_pageout loop over the inactive queue, instead of refusing to do anything. clarify the intent of the addl_page_shortage counter
Modified Paths:
--------------
trunk/sys/vm/vm_pageout.c
Modified: trunk/sys/vm/vm_pageout.c
===================================================================
--- trunk/sys/vm/vm_pageout.c 2016-09-15 09:01:42 UTC (rev 8013)
+++ trunk/sys/vm/vm_pageout.c 2016-09-15 09:02:47 UTC (rev 8014)
@@ -754,6 +754,12 @@
*/
uma_reclaim();
+ /*
+ * The addl_page_shortage is the the number of temporarily
+ * stuck pages in the inactive queue. In other words, the
+ * number of pages from cnt.v_inactive_count that should be
+ * discounted in setting the target for the active queue scan.
+ */
addl_page_shortage = atomic_readandclear_int(&vm_pageout_deficit);
/*
@@ -810,39 +816,32 @@
("Unmanaged page %p cannot be in inactive queue", m));
/*
- * Lock the page.
+ * The page or object lock acquisitions fail if the
+ * page was removed from the queue or moved to a
+ * different position within the queue. In either
+ * case, addl_page_shortage should not be incremented.
*/
if (!vm_pageout_page_lock(m, &next)) {
vm_page_unlock(m);
- addl_page_shortage++;
continue;
}
-
- /*
- * A held page may be undergoing I/O, so skip it.
- */
- if (m->hold_count) {
+ object = m->object;
+ if (!VM_OBJECT_TRYLOCK(object) &&
+ !vm_pageout_fallback_object_lock(m, &next)) {
vm_page_unlock(m);
- vm_page_requeue(m);
- addl_page_shortage++;
+ VM_OBJECT_UNLOCK(object);
continue;
}
/*
- * Don't mess with busy pages, keep in the front of the
- * queue, most likely are being paged out.
+ * Don't mess with busy pages, keep them at at the
+ * front of the queue, most likely they are being
+ * paged out. Increment addl_page_shortage for busy
+ * pages, because they may leave the inactive queue
+ * shortly after page scan is finished.
*/
- object = m->object;
- if (!VM_OBJECT_TRYLOCK(object) &&
- (!vm_pageout_fallback_object_lock(m, &next) ||
- m->hold_count != 0)) {
- VM_OBJECT_UNLOCK(object);
+ if (m->busy != 0 || (m->oflags & VPO_BUSY) != 0) {
vm_page_unlock(m);
- addl_page_shortage++;
- continue;
- }
- if (m->busy || (m->oflags & VPO_BUSY)) {
- vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
addl_page_shortage++;
continue;
@@ -901,6 +900,21 @@
goto relock_queues;
}
+ if (m->hold_count != 0) {
+ vm_page_unlock(m);
+ VM_OBJECT_UNLOCK(object);
+
+ /*
+ * Held pages are essentially stuck in the
+ * queue. So, they ought to be discounted
+ * from cnt.v_inactive_count. See the
+ * calculation of the page_shortage for the
+ * loop over the active queue below.
+ */
+ addl_page_shortage++;
+ goto relock_queues;
+ }
+
/*
* If the upper level VM system does not believe that the page
* is fully dirty, but it is mapped for write access, then we
More information about the Midnightbsd-cvs
mailing list