Skip to content

Commit

Permalink
um: Report host OOM more nicely
Browse files Browse the repository at this point in the history
If UML runs on the host side out of memory, report this
condition more nicely.

Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
richardweinberger committed Nov 6, 2015
1 parent 1b2411c commit 70c8205
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion arch/um/kernel/tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ struct host_vm_change {
.index = 0, \
.force = force })

static void report_enomem(void)
{
printk(KERN_ERR "UML ran out of memory on the host side! "
"This can happen due to a memory limitation or "
"vm.max_map_count has been reached.\n");
}

static int do_ops(struct host_vm_change *hvc, int end,
int finished)
{
Expand Down Expand Up @@ -81,6 +88,9 @@ static int do_ops(struct host_vm_change *hvc, int end,
}
}

if (ret == -ENOMEM)
report_enomem();

return ret;
}

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

if (err)
if (err) {
if (err == -ENOMEM)
report_enomem();

goto kill;
}

*pte = pte_mkuptodate(*pte);

Expand Down

0 comments on commit 70c8205

Please sign in to comment.