Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2016 22:19:38 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r307661 - user/alc/PQ_LAUNDRY/sys/vm
Message-ID:  <201610192219.u9JMJcWj069987@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Wed Oct 19 22:19:38 2016
New Revision: 307661
URL: https://svnweb.freebsd.org/changeset/base/307661

Log:
  Always pause() for a short interval after sending a batch of dirty pages
  to secondary storage.  Previously, another laundering run could start
  right after sending the batch, which is not what we intended.
  
  Use different wait messages when the laundry thread pauses versus sleeps.
  
  Reviewed by:	markj

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	Wed Oct 19 21:50:57 2016	(r307660)
+++ user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Wed Oct 19 22:19:38 2016	(r307661)
@@ -1214,7 +1214,7 @@ trybackground:
 		}
 
 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
@@ -1222,20 +1222,18 @@ dolaundry:
 			 */
 			target -= min(vm_pageout_launder(domain, launder,
 			    in_shortfall), target);
+			pause("laundp", hz / VM_LAUNDER_INTERVAL);
+		}
 
 		/*
-		 * Sleep for a little bit if we're in the middle of a laundering
-		 * run or a pagedaemon thread has signalled us since the last run
-		 * started.  Otherwise, wait for a kick from the pagedaemon.
+		 * If we're not currently laundering pages and the page daemon
+		 * hasn't posted a new request, sleep until the page daemon
+		 * kicks us.
 		 */
 		vm_pagequeue_lock(pq);
-		if (target > 0 || vm_laundry_request != VM_LAUNDRY_IDLE) {
-			vm_pagequeue_unlock(pq);
-			pause("laundr", hz / VM_LAUNDER_INTERVAL);
-			vm_pagequeue_lock(pq);
-		} else
+		if (target == 0 && vm_laundry_request == VM_LAUNDRY_IDLE)
 			(void)mtx_sleep(&vm_laundry_request,
-			    vm_pagequeue_lockptr(pq), PVM, "laundr", 0);
+			    vm_pagequeue_lockptr(pq), PVM, "launds", 0);
 
 		/*
 		 * If the pagedaemon has indicated that it's in shortfall, start



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