From 8cc3d21cc33c150b706d806adabab518b928a9b9 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Thu, 16 Sep 2004 22:17:02 -0700 Subject: [PATCH] [PATCH] tune vmalloc size There are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them. this patch adds the vmalloc= boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size. Signed-off-by: Ingo Molnar Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/kernel-parameters.txt | 11 +++++++++++ arch/i386/boot/setup.S | 2 +- arch/i386/kernel/setup.c | 8 ++++++++ arch/i386/mm/init.c | 2 ++ include/asm-i386/page.h | 6 +++--- mm/vmalloc.c | 2 ++ 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index d23b75c7a3ff1..adbe99261230e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -453,6 +453,11 @@ running once the system is up. hd?= [HW] (E)IDE subsystem hd?lun= See Documentation/ide.txt. + highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact + size of . This works even on boxes that have no + highmem otherwise. This also works to reduce highmem + size on bigger boxes. + hisax= [HW,ISDN] See Documentation/isdn/README.HiSax. @@ -1293,6 +1298,12 @@ running once the system is up. This is actually a boot loader parameter; the value is passed to the kernel using a special protocol. + vmalloc=nn[KMG] [KNL,BOOT] forces the vmalloc area to have an exact + size of . This can be used to increase the + minimum size (128MB on x86). It can also be used to + decrease the size and leave more room for directly + mapped kernel RAM. + vmhalt= [KNL,S390] vmpoff= [KNL,S390] diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index d606d06877271..5623e821f9905 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S @@ -156,7 +156,7 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later) # can be located anywhere in # low memory 0x10000 or higher. -ramdisk_max: .long (MAXMEM-1) & 0x7fffffff +ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff # (Header version 0x0203 or later) # The highest safe address for # the contents of an initrd diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index ada5e8bcedbaf..19827c0c57280 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -815,6 +815,14 @@ static void __init parse_cmdline_early (char ** cmdline_p) if (c == ' ' && !memcmp(from, "highmem=", 8)) highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; + /* + * vmalloc=size forces the vmalloc area to be exactly 'size' + * bytes. This can be used to increase (or decrease) the + * vmalloc area - the default is 128m. + */ + if (c == ' ' && !memcmp(from, "vmalloc=", 8)) + __VMALLOC_RESERVE = memparse(from+8, &from); + c = *(from++); if (!c) break; diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index a8bd0544ab2c9..9df6213440b97 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -40,6 +40,8 @@ #include #include +unsigned int __VMALLOC_RESERVE = 128 << 20; + DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); unsigned long highstart_pfn, highend_pfn; diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index fc3fb25278de0..12a237bdbdcb5 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -94,13 +94,13 @@ typedef struct { unsigned long pgprot; } pgprot_t; * and CONFIG_HIGHMEM64G options in the kernel configuration. */ +#ifndef __ASSEMBLY__ + /* * This much address space is reserved for vmalloc() and iomap() * as well as fixmap mappings. */ -#define __VMALLOC_RESERVE (128 << 20) - -#ifndef __ASSEMBLY__ +extern unsigned int __VMALLOC_RESERVE; /* Pure 2^n version of get_order */ static __inline__ int get_order(unsigned long size) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e9c5fb286899f..4093deae381b9 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -247,6 +247,8 @@ found: out: write_unlock(&vmlist_lock); kfree(area); + if (printk_ratelimit()) + printk(KERN_WARNING "allocation failed: out of vmalloc space - use vmalloc= to increase size.\n"); return NULL; } -- 2.53.0