From 48bec088b6a4a4674acc5b1ea919c47a5180da98 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sun, 13 Mar 2016 13:48:44 +0100 Subject: Avoid panics on physical memory exhaustion * vm/vm_resident (vm_page_grab_contig): Return NULL instead of calling panic on memory exhaustion. --- vm/vm_resident.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vm/vm_resident.c b/vm/vm_resident.c index fa7a337b..79481a7b 100644 --- a/vm/vm_resident.c +++ b/vm/vm_resident.c @@ -905,8 +905,10 @@ vm_page_t vm_page_grab_contig( /* TODO Allow caller to pass type */ mem = vm_page_alloc_pa(order, selector, VM_PT_KERNEL); - if (mem == NULL) - panic("vm_page_grab_contig"); + if (mem == NULL) { + simple_unlock(&vm_page_queue_free_lock); + return NULL; + } for (i = 0; i < nr_pages; i++) { mem[i].free = FALSE; -- cgit v1.2.3