Skip to content

Commit

Permalink
mm/vmalloc.c: report more vmalloc failures
Browse files Browse the repository at this point in the history
Some vmalloc failure paths do not report OOM conditions.

Add warn_alloc_failed, which also does a dump_stack, to those failure
paths.

This allows more site specific vmalloc failure logging message printks to
be removed.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Nov 1, 2011
1 parent f0dfcde commit de7d2b5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1625,13 +1625,12 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,

size = PAGE_ALIGN(size);
if (!size || (size >> PAGE_SHIFT) > totalram_pages)
return NULL;
goto fail;

area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST,
start, end, node, gfp_mask, caller);

if (!area)
return NULL;
goto fail;

addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);

Expand All @@ -1649,6 +1648,12 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
kmemleak_alloc(addr, real_size, 3, gfp_mask);

return addr;

fail:
warn_alloc_failed(gfp_mask, 0,
"vmalloc: allocation failure: %lu bytes\n",
real_size);
return NULL;
}

/**
Expand Down

0 comments on commit de7d2b5

Please sign in to comment.