Index: head/sys/kern/uipc_mbuf.c =================================================================== --- head/sys/kern/uipc_mbuf.c +++ head/sys/kern/uipc_mbuf.c @@ -1616,22 +1616,18 @@ { struct mbuf_ext_pgs *ext_pgs; vm_page_t pg; - int wire_adj; MBUF_EXT_PGS_ASSERT(m); ext_pgs = m->m_ext.ext_pgs; - wire_adj = 0; for (int i = 0; i < ext_pgs->npgs; i++) { pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); /* * Note: page is not locked, as it has no * object and is not on any queues. */ - vm_page_free_toq(pg); - wire_adj++; + vm_page_unwire_noq(pg); + vm_page_free(pg); } - if (wire_adj) - vm_wire_sub(wire_adj); } static struct mbuf * @@ -1640,9 +1636,10 @@ struct mbuf *m, *mb, *prev; struct mbuf_ext_pgs *pgs; vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; - int error, length, i, needed, wire_adj = 0; + int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED; /* * len can be zero or an arbitrary large value bound by @@ -1676,9 +1673,6 @@ retry_page: pg_array[i] = vm_page_alloc(NULL, 0, pflags); if (pg_array[i] == NULL) { - if (wire_adj) - vm_wire_add(wire_adj); - wire_adj = 0; if (how & M_NOWAIT) { goto failed; } else { @@ -1686,15 +1680,12 @@ goto retry_page; } } - wire_adj++; pg_array[i]->flags &= ~PG_ZERO; pgs->pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); pgs->npgs++; } pgs->last_pg_len = length - PAGE_SIZE * (pgs->npgs - 1); MBUF_EXT_PGS_ASSERT_SANITY(pgs); - vm_wire_add(wire_adj); - wire_adj = 0; total -= length; error = uiomove_fromphys(pg_array, 0, length, uio); if (error != 0)