1 From: Nick Piggin <npiggin@suse.de>
2 Subject: mm: improve vmalloc reporting
3 Patch-upstream: no (could be merged)
6 Add a dump_stack and some information about allocation size when vmalloc
7 fails, and also pass down caller information for some of the vmalloc
8 variants (rather than report those variants themselves as the caller
11 Signed-off-by: Nick Piggin <npiggin@suse.de>
13 mm/vmalloc.c | 13 ++++++++-----
14 1 file changed, 8 insertions(+), 5 deletions(-)
16 Index: linux-2.6.27/mm/vmalloc.c
17 ===================================================================
18 --- linux-2.6.27.orig/mm/vmalloc.c
19 +++ linux-2.6.27/mm/vmalloc.c
20 @@ -279,8 +279,11 @@ found:
22 write_unlock(&vmlist_lock);
24 - if (printk_ratelimit())
25 + if (printk_ratelimit()) {
26 printk(KERN_WARNING "allocation failed: out of vmalloc space - use vmalloc=<size> to increase size.\n");
27 + printk(KERN_WARNING "vmalloc size=%lx flags=%lx start=%lx end=%lx node=%d gfp=%lx\n", size, flags, start, end, node, (unsigned long)gfp_mask);
33 @@ -604,7 +607,7 @@ void *vmalloc_user(unsigned long size)
34 struct vm_struct *area;
37 - ret = __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
38 + ret = __vmalloc_node(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL, -1, __builtin_return_address(0));
40 write_lock(&vmlist_lock);
41 area = __find_vm_area(ret);
42 @@ -651,7 +654,7 @@ EXPORT_SYMBOL(vmalloc_node);
44 void *vmalloc_exec(unsigned long size)
46 - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC);
47 + return __vmalloc_node(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC, -1, __builtin_return_address(0));
50 #if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32)
51 @@ -671,7 +674,7 @@ void *vmalloc_exec(unsigned long size)
53 void *vmalloc_32(unsigned long size)
55 - return __vmalloc(size, GFP_VMALLOC32, PAGE_KERNEL);
56 + return __vmalloc_node(size, GFP_VMALLOC32, PAGE_KERNEL, -1, __builtin_return_address(0));
58 EXPORT_SYMBOL(vmalloc_32);
60 @@ -687,7 +690,7 @@ void *vmalloc_32_user(unsigned long size
61 struct vm_struct *area;
64 - ret = __vmalloc(size, GFP_VMALLOC32 | __GFP_ZERO, PAGE_KERNEL);
65 + ret = __vmalloc_node(size, GFP_VMALLOC32 | __GFP_ZERO, PAGE_KERNEL, -1, __builtin_return_address(0));
67 write_lock(&vmlist_lock);
68 area = __find_vm_area(ret);