aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorChris Wright <chrisw@osdl.org>2005-06-21 20:14:52 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:16 -0400
commit73219d178051691a56d57184d8c7f6d0cbe3c5c1 (patch)
treec527691510f5a2b757eac424c5671704084fc9eb /mm/mmap.c
parent1363c3cd8603a913a27e2995dccbd70d5312d8e6 (diff)
[PATCH] mmap topdown fix for large stack limit, large allocation
The topdown changes in 2.6.12-rc1 can cause large allocations with large stack limit to fail, despite there being space available. The mmap_base-len is only valid when len >= mmap_base. However, nothing in topdown allocator checks this. It's only (now) caught at higher level, which will cause allocation to simply fail. The following change restores the fallback to bottom-up path, which will allow large allocations with large stack limit to potentially still succeed. Signed-off-by: Chris Wright <chrisw@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 9da23c1ef9dc..da3fa90a0aae 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1267,6 +1267,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1267 return (mm->free_area_cache = addr-len); 1267 return (mm->free_area_cache = addr-len);
1268 } 1268 }
1269 1269
1270 if (mm->mmap_base < len)
1271 goto bottomup;
1272
1270 addr = mm->mmap_base-len; 1273 addr = mm->mmap_base-len;
1271 1274
1272 do { 1275 do {
@@ -1288,6 +1291,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1288 addr = vma->vm_start-len; 1291 addr = vma->vm_start-len;
1289 } while (len < vma->vm_start); 1292 } while (len < vma->vm_start);
1290 1293
1294bottomup:
1291 /* 1295 /*
1292 * A failed mmap() very likely causes application failure, 1296 * A failed mmap() very likely causes application failure,
1293 * so fall back to the bottom-up function here. This scenario 1297 * so fall back to the bottom-up function here. This scenario