aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-05-02 13:27:12 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:12 -0400
commit0d08e0d3a97cce22ebf80b54785e00d9b94e1add (patch)
tree341ce0f925a6f922118eac2c9a9c9c3e4a345d9b /mm/vmalloc.c
parentbbf30a1650be396b5467f769f4fbee715f16ec36 (diff)
[PATCH] x86-64: Fix vmalloc_32 to really allocate <4GB on 64bit platforms
Ugly ifdef, but should handle all 64bit platforms that have suitable zones. On some like Altix it's probably impossible without IOMMU use to get memory <4GB this way, but they have to live with that. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 9eef486da909..cb5aabda7046 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -431,7 +431,7 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
431 area->flags |= VM_VPAGES; 431 area->flags |= VM_VPAGES;
432 } else { 432 } else {
433 pages = kmalloc_node(array_size, 433 pages = kmalloc_node(array_size,
434 (gfp_mask & ~(__GFP_HIGHMEM | __GFP_ZERO)), 434 (gfp_mask & GFP_LEVEL_MASK),
435 node); 435 node);
436 } 436 }
437 area->pages = pages; 437 area->pages = pages;
@@ -577,6 +577,14 @@ void *vmalloc_exec(unsigned long size)
577 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC); 577 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC);
578} 578}
579 579
580#if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32)
581#define GFP_VMALLOC32 GFP_DMA32
582#elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA)
583#define GFP_VMALLOC32 GFP_DMA
584#else
585#define GFP_VMALLOC32 GFP_KERNEL
586#endif
587
580/** 588/**
581 * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) 589 * vmalloc_32 - allocate virtually contiguous memory (32bit addressable)
582 * @size: allocation size 590 * @size: allocation size
@@ -586,7 +594,7 @@ void *vmalloc_exec(unsigned long size)
586 */ 594 */
587void *vmalloc_32(unsigned long size) 595void *vmalloc_32(unsigned long size)
588{ 596{
589 return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL); 597 return __vmalloc(size, GFP_VMALLOC32, PAGE_KERNEL);
590} 598}
591EXPORT_SYMBOL(vmalloc_32); 599EXPORT_SYMBOL(vmalloc_32);
592 600
@@ -602,7 +610,7 @@ void *vmalloc_32_user(unsigned long size)
602 struct vm_struct *area; 610 struct vm_struct *area;
603 void *ret; 611 void *ret;
604 612
605 ret = __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 613 ret = __vmalloc(size, GFP_VMALLOC32 | __GFP_ZERO, PAGE_KERNEL);
606 if (ret) { 614 if (ret) {
607 write_lock(&vmlist_lock); 615 write_lock(&vmlist_lock);
608 area = __find_vm_area(ret); 616 area = __find_vm_area(ret);