svn commit: r346543 - head/sys/vm
Mark Johnston
markj at FreeBSD.org
Tue Sep 3 14:08:13 UTC 2019
Author: markj
Date: Mon Apr 22 11:23:35 2019
New Revision: 346543
URL: https://svnweb.freebsd.org/changeset/base/346543
Log:
Disable vm map consistency checking by default on INVARIANTS kernels.
The checks are too expensive for a general-purpose kernel. Enable the
checks when DIAGNOSTIC is defined and provide a sysctl to enable the
checks in a non-DIAGNOSTIC INVARIANTS kernel.
Reviewed by: kib
Discussed with: Doug Moore <dougm at rice.edu>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19999
Modified:
head/sys/vm/vm_map.c
Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c Mon Apr 22 11:21:20 2019 (r346542)
+++ head/sys/vm/vm_map.c Mon Apr 22 11:23:35 2019 (r346543)
@@ -670,6 +670,14 @@ _vm_map_assert_locked(vm_map_t map, const char *file,
#define VM_MAP_ASSERT_LOCKED(map) \
_vm_map_assert_locked(map, LOCK_FILE, LOCK_LINE)
+#ifdef DIAGNOSTIC
+static int enable_vmmap_check = 1;
+#else
+static int enable_vmmap_check = 0;
+#endif
+SYSCTL_INT(_debug, OID_AUTO, vmmap_check, CTLFLAG_RWTUN,
+ &enable_vmmap_check, 0, "Enable vm map consistency checking");
+
static void
_vm_map_assert_consistent(vm_map_t map)
{
@@ -677,6 +685,9 @@ _vm_map_assert_consistent(vm_map_t map)
vm_map_entry_t child;
vm_size_t max_left, max_right;
+ if (!enable_vmmap_check)
+ return;
+
for (entry = map->header.next; entry != &map->header;
entry = entry->next) {
KASSERT(entry->prev->end <= entry->start,
@@ -714,7 +725,7 @@ _vm_map_assert_consistent(vm_map_t map)
#else
#define VM_MAP_ASSERT_LOCKED(map)
#define VM_MAP_ASSERT_CONSISTENT(map)
-#endif
+#endif /* INVARIANTS */
/*
* _vm_map_unlock_and_wait:
More information about the svn-src-all
mailing list