summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJan Kiszka2006-07-14 09:23:56 +0200
committerLinus Torvalds2006-07-15 06:53:51 +0200
commit8757d5fa6b75e8ea906baf0309d49b980e7f9bc9 (patch)
treeec3c1a505b5254133cd453c922beb8db226d03e6 /mm
parent[PATCH] IB/core: use correct gfp_mask in sa_query (diff)
downloadkernel-qcow2-linux-8757d5fa6b75e8ea906baf0309d49b980e7f9bc9.tar.gz
kernel-qcow2-linux-8757d5fa6b75e8ea906baf0309d49b980e7f9bc9.tar.xz
kernel-qcow2-linux-8757d5fa6b75e8ea906baf0309d49b980e7f9bc9.zip
[PATCH] mm: fix oom roll-back of __vmalloc_area_node
__vunmap must not rely on area->nr_pages when picking the release methode for area->pages. It may be too small when __vmalloc_area_node failed early due to lacking memory. Instead, use a flag in vmstruct to differentiate. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmalloc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 7b450798b458..266162d2ba28 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -340,7 +340,7 @@ void __vunmap(void *addr, int deallocate_pages)
__free_page(area->pages[i]);
}
- if (area->nr_pages > PAGE_SIZE/sizeof(struct page *))
+ if (area->flags & VM_VPAGES)
vfree(area->pages);
else
kfree(area->pages);
@@ -427,9 +427,10 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
area->nr_pages = nr_pages;
/* Please note that the recursion is strictly bounded. */
- if (array_size > PAGE_SIZE)
+ if (array_size > PAGE_SIZE) {
pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node);
- else
+ area->flags |= VM_VPAGES;
+ } else
pages = kmalloc_node(array_size, (gfp_mask & ~__GFP_HIGHMEM), node);
area->pages = pages;
if (!area->pages) {