Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jan 2020 19:26:04 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356280 - head/sys/vm
Message-ID:  <202001021926.002JQ4hK000108@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Jan  2 19:26:04 2020
New Revision: 356280
URL: https://svnweb.freebsd.org/changeset/base/356280

Log:
  Clear queue operation flags when migrating a page to another queue.
  
  The page daemon loops may move pages back to the active queue if
  references are detected.  In this case we must take care to clear
  existing queue operation flags.  In particular, PGA_REQUEUE_HEAD may be
  set, and that flag is only valid if the page belongs to the inactive
  queue.
  
  Also fix a bug in the active queue scan where we were updating "old"
  instead of "new".  This would only have been hit in rare cases where the
  page moved out of the active queue after the beginning of the scan.
  
  Reported by:	Bob Prohaska, Idwer Vollering
  Tested by:	Idwer Vollering
  Reviewed by:	alc, kib
  Differential Revision:	https://reviews.freebsd.org/D23001

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Thu Jan  2 18:46:33 2020	(r356279)
+++ head/sys/vm/vm_pageout.c	Thu Jan  2 19:26:04 2020	(r356280)
@@ -834,6 +834,7 @@ scan:
 				if (new.act_count > ACT_MAX)
 					new.act_count = ACT_MAX;
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = PQ_ACTIVE;
 				if (!vm_page_pqstate_commit(m, &old, new))
@@ -1313,8 +1314,9 @@ act_scan:
 				 */
 				ps_delta = 0;
 				if (old.queue != PQ_ACTIVE) {
-					old.queue = PQ_ACTIVE;
-					old.flags |= PGA_REQUEUE;
+					new.flags &= ~PGA_QUEUE_OP_MASK;
+					new.flags |= PGA_REQUEUE;
+					new.queue = PQ_ACTIVE;
 				}
 			} else {
 				/*
@@ -1350,6 +1352,7 @@ act_scan:
 					ps_delta = 1;
 				}
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = nqueue;
 			}
@@ -1560,6 +1563,7 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh
 				if (new.act_count > ACT_MAX)
 					new.act_count = ACT_MAX;
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = PQ_ACTIVE;
 				if (!vm_page_pqstate_commit(m, &old, new))



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