svn commit: r331879 - head/sys/vm

Mark Johnston markj at FreeBSD.org
Mon Apr 2 15:07:41 UTC 2018


Author: markj
Date: Mon Apr  2 15:07:41 2018
New Revision: 331879
URL: https://svnweb.freebsd.org/changeset/base/331879

Log:
  Ensure the background laundering threshold is positive after a scan.
  
  The division added in r331732 meant that we wouldn't attempt a
  background laundering until at least v_free_target - v_free_min clean
  pages had been freed by the page daemon since the last laundering. If
  the inactive queue is depleted but not completely empty (e.g., because
  it contains busy pages), it can thus take a long time to meet this
  threshold. Restore the pre-r331732 behaviour of using a non-zero
  background laundering threshold if at least one inactive queue scan has
  elapsed since the last attempt at background laundering.
  
  Submitted by:	tijl (original version)

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Mon Apr  2 13:45:23 2018	(r331878)
+++ head/sys/vm/vm_pageout.c	Mon Apr  2 15:07:41 2018	(r331879)
@@ -1015,14 +1015,16 @@ vm_pageout_laundry_worker(void *arg)
 		 * clean pages freed by the page daemon since the last
 		 * background laundering.  Thus, as the ratio of dirty to
 		 * clean inactive pages grows, the amount of memory pressure
-		 * required to trigger laundering decreases.
+		 * required to trigger laundering decreases.  We ensure
+		 * that the threshold is non-zero after an inactive queue
+		 * scan, even if that scan failed to free a single clean page.
 		 */
 trybackground:
 		nclean = vmd->vmd_free_count +
 		    vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt;
 		ndirty = vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt;
-		if (target == 0 && ndirty * isqrt(nfreed /
-		    (vmd->vmd_free_target - vmd->vmd_free_min)) >= nclean) {
+		if (target == 0 && ndirty * isqrt(howmany(nfreed + 1,
+		    vmd->vmd_free_target - vmd->vmd_free_min)) >= nclean) {
 			target = vmd->vmd_background_launder_target;
 		}
 


More information about the svn-src-head mailing list