svn commit: r354083 - head/sys/vm

Gleb Smirnoff glebius at FreeBSD.org
Fri Oct 25 16:59:55 UTC 2019


Author: glebius
Date: Fri Oct 25 16:59:54 2019
New Revision: 354083
URL: https://svnweb.freebsd.org/changeset/base/354083

Log:
  Add couple more assertions to vm_pager_assert_in().  The bogus page is
  not allowed at ends of the request, and all non-bogus pages must be
  consecutive.
  
  Reviewed by:	kib

Modified:
  head/sys/vm/vm_pager.c

Modified: head/sys/vm/vm_pager.c
==============================================================================
--- head/sys/vm/vm_pager.c	Fri Oct 25 16:30:24 2019	(r354082)
+++ head/sys/vm/vm_pager.c	Fri Oct 25 16:59:54 2019	(r354083)
@@ -257,15 +257,20 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i
 {
 #ifdef INVARIANTS
 
-	VM_OBJECT_ASSERT_WLOCKED(object);
-	KASSERT(count > 0, ("%s: 0 count", __func__));
 	/*
-	 * All pages must be busied, not mapped, not fully valid,
-	 * not dirty and belong to the proper object.
+	 * All pages must be consecutive, busied, not mapped, not fully valid,
+	 * not dirty and belong to the proper object.  Some pages may be the
+	 * bogus page, but the first and last pages must be a real ones.
 	 */
+
+	VM_OBJECT_ASSERT_WLOCKED(object);
+	KASSERT(count > 0, ("%s: 0 count", __func__));
 	for (int i = 0 ; i < count; i++) {
-		if (m[i] == bogus_page)
+		if (m[i] == bogus_page) {
+			KASSERT(i != 0 && i != count - 1,
+			    ("%s: page %d is the bogus page", __func__, i));
 			continue;
+		}
 		vm_page_assert_xbusied(m[i]);
 		KASSERT(!pmap_page_is_mapped(m[i]),
 		    ("%s: page %p is mapped", __func__, m[i]));
@@ -275,6 +280,8 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i
 		    ("%s: page %p is dirty", __func__, m[i]));
 		KASSERT(m[i]->object == object,
 		    ("%s: wrong object %p/%p", __func__, object, m[i]->object));
+		KASSERT(m[i]->pindex == m[0]->pindex + i,
+		    ("%s: page %p isn't consecutive", __func__, m[i]));
 	}
 #endif
 }


More information about the svn-src-head mailing list