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
This commit is contained in:
Mark Johnston 2020-01-03 18:48:53 +00:00
parent 3a22f09cbf
commit 2c14385aa2

View File

@ -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 */