svn commit: r356326 - head/sys/dev/md
Mark Johnston
markj at FreeBSD.org
Fri Jan 3 18:48:53 UTC 2020
Author: markj
Date: Fri Jan 3 18:48:53 2020
New Revision: 356326
URL: https://svnweb.freebsd.org/changeset/base/356326
Log:
Fix a page leak in the md(4) swap I/O path.
r356147 removed a vm_page_activate() call, but this is required to
ensure that pages end up in the page queues in the first place.
Restore the pre-r356157 logic. Now, without the page lock, the
vm_page_active() check is racy, but this race is harmless.
Reviewed by: alc, kib
Reported and tested by: pho
Differential Revision: https://reviews.freebsd.org/D23024
Modified:
head/sys/dev/md/md.c
Modified: head/sys/dev/md/md.c
==============================================================================
--- head/sys/dev/md/md.c Fri Jan 3 18:29:20 2020 (r356325)
+++ head/sys/dev/md/md.c Fri Jan 3 18:48:53 2020 (r356326)
@@ -1142,7 +1142,16 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
}
if (m != NULL) {
vm_page_xunbusy(m);
- vm_page_reference(m);
+
+ /*
+ * The page may be deactivated prior to setting
+ * PGA_REFERENCED, but in this case it will be
+ * reactivated by the page daemon.
+ */
+ if (vm_page_active(m))
+ vm_page_reference(m);
+ else
+ vm_page_activate(m);
}
/* Actions on further pages start at offset 0 */
More information about the svn-src-all
mailing list