summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2016-03-13 13:48:44 +0100
committerRichard Braun <rbraun@sceen.net>2016-03-13 13:49:16 +0100
commit48bec088b6a4a4674acc5b1ea919c47a5180da98 (patch)
tree66c78444e45b492f9e20a18ad54f12fb9512a274
parentdb656dd03b9b0a2bc955c43c58a2ef88f2bdf35c (diff)
Avoid panics on physical memory exhaustion
* vm/vm_resident (vm_page_grab_contig): Return NULL instead of calling panic on memory exhaustion.
-rw-r--r--vm/vm_resident.c6
1 files 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;