diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 7ff561d52a2b..8157649330d8 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1918,8 +1918,13 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, if ((options & OBJPR_NOTMAPPED) == 0) { pmap_remove_all(p); /* Account for removal of wired mappings. */ - if (wirings != 0) - p->wire_count -= wirings; + if (wirings != 0) { + KASSERT(p->wire_count == wirings, + ("inconsistent wire count %d %d %p", + p->wire_count, wirings, p)); + p->wire_count = 0; + atomic_subtract_int(&cnt.v_wire_count, 1); + } } vm_page_free(p); vm_page_unlock(p);