Index: sys/vm/swap_pager.c =================================================================== --- sys/vm/swap_pager.c +++ sys/vm/swap_pager.c @@ -2580,6 +2580,9 @@ else bio = g_alloc_bio(); if (bio == NULL) { + mtx_lock(&sw_dev_mtx); + cp->index--; + mtx_unlock(&sw_dev_mtx); bp->b_error = ENOMEM; bp->b_ioflags |= BIO_ERROR; bufdone(bp); @@ -2682,6 +2685,7 @@ cp = g_new_consumer(gp); cp->index = 0; /* Number of active I/Os. */ cp->private = NULL; /* Orphanization flag */ + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; g_attach(cp, pp); /* * XXX: Everytime you think you can improve the margin for