Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jul 2019 18:46:39 +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: r349671 - head/sys/vm
Message-ID:  <201907031846.x63IkdBZ040503@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Jul  3 18:46:39 2019
New Revision: 349671
URL: https://svnweb.freebsd.org/changeset/base/349671

Log:
  Cache the next queue element when traversing a page queue.
  
  When QUEUE_MACRO_DEBUG_TRASH is configured, removing a queue element
  invalidates its queue linkage pointers.  vm_pageout_collect_batch()
  was relying on these pointers remaining valid after a removal, so
  modify it to fetch the next queued page before dequeuing the current
  page.
  
  Submitted by:	Don Morris <dgmorris@earthlink.net>
  Reviewed by:	cem, vangyzen
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D20842

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Wed Jul  3 18:29:18 2019	(r349670)
+++ head/sys/vm/vm_pageout.c	Wed Jul  3 18:46:39 2019	(r349671)
@@ -266,7 +266,7 @@ static __always_inline void
 vm_pageout_collect_batch(struct scan_state *ss, const bool dequeue)
 {
 	struct vm_pagequeue *pq;
-	vm_page_t m, marker;
+	vm_page_t m, marker, n;
 
 	marker = ss->marker;
 	pq = ss->pq;
@@ -277,7 +277,8 @@ vm_pageout_collect_batch(struct scan_state *ss, const 
 	vm_pagequeue_lock(pq);
 	for (m = TAILQ_NEXT(marker, plinks.q); m != NULL &&
 	    ss->scanned < ss->maxscan && ss->bq.bq_cnt < VM_BATCHQUEUE_SIZE;
-	    m = TAILQ_NEXT(m, plinks.q), ss->scanned++) {
+	    m = n, ss->scanned++) {
+		n = TAILQ_NEXT(m, plinks.q);
 		if ((m->flags & PG_MARKER) == 0) {
 			KASSERT((m->aflags & PGA_ENQUEUED) != 0,
 			    ("page %p not enqueued", m));



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