Date: Fri, 3 Jan 2020 18:48:53 +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: r356326 - head/sys/dev/md Message-ID: <202001031848.003ImrTs041910@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001031848.003ImrTs041910>