Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 17:28:14 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r303496 - user/alc/PQ_LAUNDRY/sys/vm
Message-ID:  <201607291728.u6THSEtf086726@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Jul 29 17:28:14 2016
New Revision: 303496
URL: https://svnweb.freebsd.org/changeset/base/303496

Log:
  Remove a redundant variable for the target number of laundry cycles.
  
  Suggested by:	alc

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	Fri Jul 29 17:18:47 2016	(r303495)
+++ user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Fri Jul 29 17:28:14 2016	(r303496)
@@ -1090,7 +1090,7 @@ vm_pageout_laundry_worker(void *arg)
 	struct vm_domain *domain;
 	uint64_t ninact, nlaundry;
 	u_int wakeups, gen;
-	int cycle, tcycle, domidx, launder;
+	int cycle, domidx, launder;
 	int shortfall, prev_shortfall, target;
 
 	domidx = (uintptr_t)arg;
@@ -1098,7 +1098,7 @@ vm_pageout_laundry_worker(void *arg)
 	KASSERT(domain->vmd_segs != 0, ("domain without segments"));
 	vm_pageout_init_marker(&domain->vmd_laundry_marker, PQ_LAUNDRY);
 
-	cycle = tcycle = 0;
+	cycle = 0;
 	gen = 0;
 	shortfall = prev_shortfall = 0;
 	target = 0;
@@ -1122,10 +1122,9 @@ vm_pageout_laundry_worker(void *arg)
 			 * If we're still in shortfall despite a previous
 			 * laundering run, start a new one.
 			 */
-			if (prev_shortfall == 0 || cycle == tcycle) {
+			if (prev_shortfall == 0 || cycle == 0) {
 				target = shortfall;
-				cycle = 0;
-				tcycle = VM_LAUNDER_RATE;
+				cycle = VM_LAUNDER_RATE;
 			}
 			prev_shortfall = shortfall;
 		}
@@ -1137,10 +1136,10 @@ vm_pageout_laundry_worker(void *arg)
 			 * shortfall, we have no immediate need to launder
 			 * pages.  Otherwise keep laundering.
 			 */
-			if (vm_laundry_target() <= 0 || cycle == tcycle) {
+			if (vm_laundry_target() <= 0 || cycle == 0) {
 				shortfall = prev_shortfall = target = 0;
 			} else {
-				launder = target / (tcycle - cycle);
+				launder = target / cycle;
 				goto dolaundry;
 			}
 		}
@@ -1168,8 +1167,7 @@ vm_pageout_laundry_worker(void *arg)
 			 * the inactive and laundry queues.  We attempt to
 			 * finish within one second.
 			 */
-			cycle = 0;
-			tcycle = VM_LAUNDER_INTERVAL;
+			cycle = VM_LAUNDER_INTERVAL;
 
 			/*
 			 * Set our target to that of the pagedaemon, scaled by
@@ -1190,8 +1188,8 @@ vm_pageout_laundry_worker(void *arg)
 			 */
 			target = min(target, bkgrd_launder_max);
 		}
-		if (target > 0 && cycle != tcycle)
-			launder = target / (tcycle - cycle);
+		if (target > 0 && cycle != 0)
+			launder = target / cycle;
 
 dolaundry:
 		if (launder > 0)
@@ -1200,7 +1198,7 @@ dolaundry:
 
 		tsleep(&vm_cnt.v_laundry_count, PVM, "laundr",
 		    hz / VM_LAUNDER_INTERVAL);
-		cycle++;
+		cycle--;
 	}
 }
 



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