Skip to content

Commit 70c8205

Browse files
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>
1 parent 1b2411c commit 70c8205

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎arch/um/kernel/tlb.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ struct host_vm_change {
5050
.index = 0, \
5151
.force = force })
5252

53+
static 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+
5360
static int do_ops(struct host_vm_change *hvc, int end,
5461
int finished)
5562
{
@@ -81,6 +88,9 @@ static int do_ops(struct host_vm_change *hvc, int end,
8188
}
8289
}
8390

91+
if (ret == -ENOMEM)
92+
report_enomem();
93+
8494
return ret;
8595
}
8696

@@ -433,8 +443,12 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
433443
else if (pte_newprot(*pte))
434444
err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush);
435445

436-
if (err)
446+
if (err) {
447+
if (err == -ENOMEM)
448+
report_enomem();
449+
437450
goto kill;
451+
}
438452

439453
*pte = pte_mkuptodate(*pte);
440454

0 commit comments

Comments
 (0)