Index: sys/vm/vm_page.c =================================================================== --- sys/vm/vm_page.c +++ sys/vm/vm_page.c @@ -1633,6 +1633,7 @@ * vm_page_cache(). */ mtx_lock_flags(&vm_page_queue_free_mtx, MTX_RECURSE); + m = NULL; if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) || @@ -1677,7 +1678,19 @@ } #endif } - } else { + } + + /* + * Can't allocate or attempted to and couldn't allocate a page + * given the current VM policy. Give up. + * + * Note - yes, this is one of the current shortcomings of the + * VM domain design - there's a global set of vm_cnt counters, + * and it's quite possible things will get unhappy with this. + * However without it'll kernel panic below - the code didn't + * check m == NULL here and would continue. + */ + if (m == NULL) { /* * Not allocatable, give up. */