Index: sys/kern/subr_vmem.c =================================================================== --- sys/kern/subr_vmem.c +++ sys/kern/subr_vmem.c @@ -1108,13 +1108,14 @@ error = ENOMEM; VMEM_LOCK(vm); -retry: + /* * Make sure we have enough tags to complete the operation. */ if (bt_fill(vm, flags) != 0) goto out; +retry: /* * Find the next free tag meeting our constraints. If one is found, * perform the allocation. @@ -1390,16 +1391,16 @@ */ first = bt_freehead_toalloc(vm, size, strat); VMEM_LOCK(vm); - for (;;) { - /* - * Make sure we have enough tags to complete the - * operation. - */ - if (bt_fill(vm, flags) != 0) { - error = ENOMEM; - break; - } + /* + * Make sure we have enough tags to complete the + * operation. + */ + if (bt_fill(vm, flags) != 0) { + error = ENOMEM; + goto out; + } + for (;;) { /* * Scan freelists looking for a tag that satisfies the * allocation. If we're doing BESTFIT we may encounter