aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-10-25 17:26:09 -0400
committerRichard Weinberger <richard@nod.at>2015-11-06 16:49:12 -0500
commit70c8205f40a385383b0c81f59550cf27273bf912 (patch)
tree3186e2e340000c4cb2b237460d6cb68b52e59003
parent1b2411c283e8e178b1c57d07f7fe082442a0927b (diff)
um: Report host OOM more nicely
If UML runs on the host side out of memory, report this condition more nicely. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--arch/um/kernel/tlb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 2077248e8a72..3777b82759bd 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -50,6 +50,13 @@ struct host_vm_change {
50 .index = 0, \ 50 .index = 0, \
51 .force = force }) 51 .force = force })
52 52
53static void report_enomem(void)
54{
55 printk(KERN_ERR "UML ran out of memory on the host side! "
56 "This can happen due to a memory limitation or "
57 "vm.max_map_count has been reached.\n");
58}
59
53static int do_ops(struct host_vm_change *hvc, int end, 60static int do_ops(struct host_vm_change *hvc, int end,
54 int finished) 61 int finished)
55{ 62{
@@ -81,6 +88,9 @@ static int do_ops(struct host_vm_change *hvc, int end,
81 } 88 }
82 } 89 }
83 90
91 if (ret == -ENOMEM)
92 report_enomem();
93
84 return ret; 94 return ret;
85} 95}
86 96
@@ -433,8 +443,12 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
433 else if (pte_newprot(*pte)) 443 else if (pte_newprot(*pte))
434 err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush); 444 err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush);
435 445
436 if (err) 446 if (err) {
447 if (err == -ENOMEM)
448 report_enomem();
449
437 goto kill; 450 goto kill;
451 }
438 452
439 *pte = pte_mkuptodate(*pte); 453 *pte = pte_mkuptodate(*pte);
440 454