Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2016 18:51:04 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r304917 - user/alc/PQ_LAUNDRY/sys/vm
Message-ID:  <201608271851.u7RIp4pe082303@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sat Aug 27 18:51:04 2016
New Revision: 304917
URL: https://svnweb.freebsd.org/changeset/base/304917

Log:
  Changes to vm_pageout_laundry_worker():
  
  Reset "last_launder" on each cycle of a shortfall laundering run, just
  like we do for background laundering.
  
  Update a comment about background laundering that has become stale.
  
  Apply a couple style changes for consistency with the rest of the
  function.
  
  Add a comment explaining why min() is applied to the return value from
  vm_pageout_launder().
  
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c

Modified: user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c
==============================================================================
--- user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Sat Aug 27 18:12:42 2016	(r304916)
+++ user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Sat Aug 27 18:51:04 2016	(r304917)
@@ -1158,8 +1158,8 @@ vm_pageout_laundry_worker(void *arg)
 			 */
 			if (vm_laundry_target() <= 0 || cycle == 0) {
 				prev_shortfall = target = 0;
-				last_launder = wakeups;
 			} else {
+				last_launder = wakeups;
 				launder = target / cycle--;
 				goto dolaundry;
 			}
@@ -1171,7 +1171,8 @@ vm_pageout_laundry_worker(void *arg)
 		 *
 		 * 1. The ratio of dirty to clean inactive pages exceeds the
 		 *    background laundering threshold and the pagedaemon has
-		 *    recently been woken up, or
+		 *    been woken up to reclaim pages since our last
+		 *    laundering, or
 		 * 2. we haven't yet reached the target of the current
 		 *    background laundering run.
 		 *
@@ -1188,6 +1189,7 @@ vm_pageout_laundry_worker(void *arg)
 			last_launder = wakeups;
 			target = starting_target = vm_background_launder_target;
 		}
+
 		/*
 		 * We have a non-zero background laundering target.  If we've
 		 * laundered up to our maximum without observing a page daemon
@@ -1197,14 +1199,13 @@ vm_pageout_laundry_worker(void *arg)
 		 * proceed at the background laundering rate.
 		 */
 		if (target > 0) {
-			if (last_launder != wakeups) {
+			if (wakeups != last_launder) {
 				last_launder = wakeups;
 				starting_target = target;
 			} else if (starting_target - target >=
 			    vm_background_launder_max * PAGE_SIZE / 1024) {
 				target = 0;
 			}
-
 			launder = vm_background_launder_rate * PAGE_SIZE / 1024;
 			launder /= VM_LAUNDER_INTERVAL;
 			if (launder < target)
@@ -1212,10 +1213,15 @@ vm_pageout_laundry_worker(void *arg)
 		}
 
 dolaundry:
-		if (launder > 0)
+		if (launder > 0) {
+			/*
+			 * Because of I/O clustering, the number of laundered
+			 * pages could exceed "target" by the maximum size of
+			 * a cluster minus one. 
+			 */
 			target -= min(vm_pageout_launder(domain, launder,
 			    prev_shortfall > 0), target);
-
+		}
 		tsleep(&vm_cnt.v_laundry_count, PVM, "laundr",
 		    hz / VM_LAUNDER_INTERVAL);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608271851.u7RIp4pe082303>