svn commit: r304968 - in user/alc/PQ_LAUNDRY/sys: sys vm

Alan Cox alc at FreeBSD.org
Sun Aug 28 20:53:32 UTC 2016


Author: alc
Date: Sun Aug 28 20:53:31 2016
New Revision: 304968
URL: https://svnweb.freebsd.org/changeset/base/304968

Log:
  Simplify the logic for detecting shortfalls.
  
  Discussed with:	markj

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

Modified: user/alc/PQ_LAUNDRY/sys/sys/vmmeter.h
==============================================================================
--- user/alc/PQ_LAUNDRY/sys/sys/vmmeter.h	Sun Aug 28 20:39:53 2016	(r304967)
+++ user/alc/PQ_LAUNDRY/sys/sys/vmmeter.h	Sun Aug 28 20:53:31 2016	(r304968)
@@ -198,17 +198,6 @@ vm_laundry_target(void)
 }
 
 /*
- * Return true if we are in shortfall and must begin laundering dirty memory.
- */
-static inline bool
-vm_laundering_needed(void)
-{
-
-	return (vm_cnt.v_inactive_count < vm_cnt.v_inactive_target &&
-	    vm_paging_needed());
-}
-
-/*
  * Obtain the value of a per-CPU counter.
  */
 #define	VM_METER_PCPU_CNT(member)					\

Modified: user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c
==============================================================================
--- user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Sun Aug 28 20:39:53 2016	(r304967)
+++ user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c	Sun Aug 28 20:53:31 2016	(r304968)
@@ -1133,9 +1133,8 @@ vm_pageout_laundry_worker(void *arg)
 		 * First determine whether we need to launder pages to meet a
 		 * shortage of free pages.
 		 */
-		if (vm_laundering_needed()) {
-			shortfall = vm_laundry_target() + vm_pageout_deficit;
-
+		shortfall = vm_laundry_target() + vm_pageout_deficit;
+		if (shortfall > 0) {
 			/*
 			 * If we're in shortfall and we haven't yet started a
 			 * laundering cycle to get us out of it, begin a run.
@@ -1156,7 +1155,7 @@ vm_pageout_laundry_worker(void *arg)
 			 * shortfall, we have no immediate need to launder
 			 * pages.  Otherwise keep laundering.
 			 */
-			if (vm_laundry_target() <= 0 || cycle == 0) {
+			if (shortfall <= 0 || cycle == 0) {
 				prev_shortfall = target = 0;
 			} else {
 				last_launder = wakeups;


More information about the svn-src-user mailing list