svn commit: r324824 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Sat Oct 21 17:28:14 UTC 2017


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),


More information about the svn-src-head mailing list