svn commit: r303982 - head/sys/vm
Alan Cox
alc at FreeBSD.org
Fri Aug 12 03:23:00 UTC 2016
Author: alc
Date: Fri Aug 12 03:22:58 2016
New Revision: 303982
URL: https://svnweb.freebsd.org/changeset/base/303982
Log:
Correct errors and clean up the comments on the active queue scan.
Eliminate some unnecessary blank lines.
Reviewed by: kib, markj
MFC after: 1 week
Modified:
head/sys/vm/vm_pageout.c
Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c Fri Aug 12 01:13:34 2016 (r303981)
+++ head/sys/vm/vm_pageout.c Fri Aug 12 03:22:58 2016 (r303982)
@@ -1188,15 +1188,13 @@ relock_queue:
/*
* Scan the active queue for pages that can be deactivated. Update
* the per-page activity counter and use it to identify deactivation
- * candidates.
+ * candidates. Held pages may be deactivated.
*/
for (m = TAILQ_FIRST(&pq->pq_pl), scanned = 0; m != NULL && (scanned <
min_scan || (page_shortage > 0 && scanned < maxscan)); m = next,
scanned++) {
-
KASSERT(m->queue == PQ_ACTIVE,
("vm_pageout_scan: page %p isn't active", m));
-
next = TAILQ_NEXT(m, plinks.q);
if ((m->flags & PG_MARKER) != 0)
continue;
@@ -1210,8 +1208,8 @@ relock_queue:
}
/*
- * The count for pagedaemon pages is done after checking the
- * page for eligibility...
+ * The count for page daemon pages is updated after checking
+ * the page for eligibility.
*/
PCPU_INC(cnt.v_pdpages);
@@ -1225,12 +1223,17 @@ relock_queue:
act_delta = 0;
/*
- * Unlocked object ref count check. Two races are possible.
- * 1) The ref was transitioning to zero and we saw non-zero,
- * the pmap bits will be checked unnecessarily.
- * 2) The ref was transitioning to one and we saw zero.
- * The page lock prevents a new reference to this page so
- * we need not check the reference bits.
+ * Perform an unsynchronized object ref count check. While
+ * the page lock ensures that the page is not reallocated to
+ * another object, in particular, one with unmanaged mappings
+ * that cannot support pmap_ts_referenced(), two races are,
+ * nonetheless, possible:
+ * 1) The count was transitioning to zero, but we saw a non-
+ * zero value. pmap_ts_referenced() will return zero
+ * because the page is not mapped.
+ * 2) The count was transitioning to one, but we saw zero.
+ * This race delays the detection of a new reference. At
+ * worst, we will deactivate and reactivate the page.
*/
if (m->object->ref_count != 0)
act_delta += pmap_ts_referenced(m);
More information about the svn-src-head
mailing list