Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Oct 2017 17:28:12 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324824 - head/sys/vm
Message-ID:  <201710211728.v9LHSCb4065496@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Oct 21 17:28:12 2017
New Revision: 324824
URL: https://svnweb.freebsd.org/changeset/base/324824

Log:
  Check that the page which is freed as zeroed, indeed has all-zero content.
  
  This catches some rare mysterious failures at the source.  The check
  is only performed on architectures which implement direct map, and
  only enabled with option DIAGNOSTIC, similar to other costly
  consistency checks.
  
  Reviewed by:	alc, markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Sat Oct 21 16:55:52 2017	(r324823)
+++ head/sys/vm/vm_page.c	Sat Oct 21 17:28:12 2017	(r324824)
@@ -2780,6 +2780,16 @@ bool
 vm_page_free_prep(vm_page_t m, bool pagequeue_locked)
 {
 
+#if defined(DIAGNOSTIC) && defined(PHYS_TO_DMAP)
+	if ((m->flags & PG_ZERO) != 0) {
+		uint64_t *p;
+		int i;
+		p = (uint64_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
+		for (i = 0; i < PAGE_SIZE / sizeof(uint64_t); i++, p++)
+			KASSERT(*p == 0, ("vm_page_free_prep %p PG_ZERO %d %jx",
+			    m, i, (uintmax_t)*p));
+	}
+#endif
 	if ((m->oflags & VPO_UNMANAGED) == 0) {
 		vm_page_lock_assert(m, MA_OWNED);
 		KASSERT(!pmap_page_is_mapped(m),



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