Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2015 20:38:45 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287219 - head/sys/vm
Message-ID:  <201508272038.t7RKcjmS035618@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Thu Aug 27 20:38:45 2015
New Revision: 287219
URL: https://svnweb.freebsd.org/changeset/base/287219

Log:
  In vm_pageout_scan(), simplify the logic for determining if a page can be
  paged out and apply some nearby style fixes.
  
  In collaboration with:	kib
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation, EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Thu Aug 27 19:12:42 2015	(r287218)
+++ head/sys/vm/vm_pageout.c	Thu Aug 27 20:38:45 2015	(r287219)
@@ -1029,10 +1029,9 @@ vm_pageout_scan(struct vm_domain *vmd, i
 	struct vm_pagequeue *pq;
 	vm_object_t object;
 	long min_scan;
-	int act_delta, addl_page_shortage, deficit, maxscan, page_shortage;
-	int vnodes_skipped = 0;
-	int maxlaunder, scan_tick, scanned;
-	boolean_t queues_locked;
+	int act_delta, addl_page_shortage, deficit, error, maxlaunder, maxscan;
+	int page_shortage, scan_tick, scanned, vnodes_skipped;
+	boolean_t pageout_ok, queues_locked;
 
 	/*
 	 * If we need to reclaim memory ask kernel caches to return
@@ -1086,6 +1085,8 @@ vm_pageout_scan(struct vm_domain *vmd, i
 	if (pass > 1)
 		maxlaunder = 10000;
 
+	vnodes_skipped = 0;
+
 	/*
 	 * Start scanning the inactive queue for pages we can move to the
 	 * cache or free.  The scan will stop when the target is reached or
@@ -1265,23 +1266,22 @@ vm_pageout_scan(struct vm_domain *vmd, i
 			 * pressure where there are insufficient clean pages
 			 * on the inactive queue, we may have to go all out.
 			 */
-			int swap_pageouts_ok;
-			int error;
 
-			if ((object->type != OBJT_SWAP) && (object->type != OBJT_DEFAULT)) {
-				swap_pageouts_ok = 1;
-			} else {
-				swap_pageouts_ok = !(defer_swap_pageouts || disable_swap_pageouts);
-				swap_pageouts_ok |= (!disable_swap_pageouts && defer_swap_pageouts &&
-				vm_page_count_min());
-										
-			}
+			if (object->type != OBJT_SWAP &&
+			    object->type != OBJT_DEFAULT)
+				pageout_ok = TRUE;
+			else if (disable_swap_pageouts)
+				pageout_ok = FALSE;
+			else if (defer_swap_pageouts)
+				pageout_ok = vm_page_count_min();
+			else
+				pageout_ok = TRUE;
 
 			/*
 			 * We don't bother paging objects that are "dead".  
 			 * Those objects are in a "rundown" state.
 			 */
-			if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) {
+			if (!pageout_ok || (object->flags & OBJ_DEAD) != 0) {
 				vm_pagequeue_lock(pq);
 				vm_page_unlock(m);
 				VM_OBJECT_WUNLOCK(object);



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