Skip to contentSkip to conversation

mm: vmalloc - Report more vmalloc failures

PATCH New Joe Perches 1 participant 1 message Aug 31, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: vmalloc - Report more vmalloc failures

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.

---
 mm/vmalloc.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
mm/vmalloc.c +8 -3
index 3122acc..5108e0b 100644
@@ -1600,13 +1600,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, start, end, node,
 				  gfp_mask, caller);
-
 	if (!area)
-		return NULL;
+		goto fail;
 
 	addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
 
@@ -1618,6 +1617,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;
 }
 
 /**