]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Nick Piggin <npiggin@suse.de> |
2 | Subject: mm: improve vmalloc reporting | |
3 | Patch-upstream: no (could be merged) | |
4 | References: bnc#511079 | |
5 | ||
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 | |
9 | in /proc/vmallocinfo). | |
10 | ||
11 | Signed-off-by: Nick Piggin <npiggin@suse.de> | |
12 | --- | |
13 | mm/vmalloc.c | 13 ++++++++----- | |
14 | 1 file changed, 8 insertions(+), 5 deletions(-) | |
15 | ||
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: | |
21 | out: | |
22 | write_unlock(&vmlist_lock); | |
23 | kfree(area); | |
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); | |
28 | + dump_stack(); | |
29 | + } | |
30 | return NULL; | |
31 | } | |
32 | ||
33 | @@ -604,7 +607,7 @@ void *vmalloc_user(unsigned long size) | |
34 | struct vm_struct *area; | |
35 | void *ret; | |
36 | ||
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)); | |
39 | if (ret) { | |
40 | write_lock(&vmlist_lock); | |
41 | area = __find_vm_area(ret); | |
42 | @@ -651,7 +654,7 @@ EXPORT_SYMBOL(vmalloc_node); | |
43 | ||
44 | void *vmalloc_exec(unsigned long size) | |
45 | { | |
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)); | |
48 | } | |
49 | ||
50 | #if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32) | |
51 | @@ -671,7 +674,7 @@ void *vmalloc_exec(unsigned long size) | |
52 | */ | |
53 | void *vmalloc_32(unsigned long size) | |
54 | { | |
55 | - return __vmalloc(size, GFP_VMALLOC32, PAGE_KERNEL); | |
56 | + return __vmalloc_node(size, GFP_VMALLOC32, PAGE_KERNEL, -1, __builtin_return_address(0)); | |
57 | } | |
58 | EXPORT_SYMBOL(vmalloc_32); | |
59 | ||
60 | @@ -687,7 +690,7 @@ void *vmalloc_32_user(unsigned long size | |
61 | struct vm_struct *area; | |
62 | void *ret; | |
63 | ||
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)); | |
66 | if (ret) { | |
67 | write_lock(&vmlist_lock); | |
68 | area = __find_vm_area(ret); |