Skip to contentSkip to conversation

tune vmalloc size

PATCH In review Ingo Molnar 6 participants 9 messages Sep 15, 2004 – Sep 16, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Ingo

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c.orig +9 -1
@@ -814,7 +814,15 @@ static void __init parse_cmdline_early (
 		 */
 		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;
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.orig +2 -0
@@ -40,6 +40,8 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 
+unsigned int __VMALLOC_RESERVE = 128 << 20;
+
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 unsigned long highstart_pfn, highend_pfn;
 
arch/i386/boot/setup.S renamed from arch/i386/boot/setup.S.orig +1 -1
@@ -156,7 +156,7 @@ cmd_line_ptr:	.long 0			# (Header versio
 					# 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
include/asm-i386/page.h renamed from include/asm-i386/page.h.orig +3 -3
@@ -94,13 +94,13 @@ typedef struct { unsigned long pgprot; }
  * 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)
mm/vmalloc.c renamed from mm/vmalloc.c.orig +2 -0
@@ -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=<size> to increase size.\n");
 	return NULL;
 }
 
#1 lore raw
Quoted 7 lines · Ingo Molnar

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Perhaps this should instead be a configurable.
Joe

#2 lore raw
Quoted 10 lines · Joe Korty
Quoted 7 lines · Ingo Molnar

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Perhaps this should instead be a configurable.

that would make it useless for distribution kernels for eg.

Dave

#3 lore raw
In reply to Joe Korty
Quoted 10 lines · Joe Korty
Quoted 7 lines · Ingo Molnar

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Perhaps this should instead be a configurable.

boot time settable is 100x better than only compile time settable imo :)

#4 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 5 lines · Joe Korty
Quoted 4 lines · Ingo Molnar

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Perhaps this should instead be a configurable.

boot time settable is 100x better than only compile time settable imo :)

IMO, everything that is changable at boot time needs an equivalent way of changing the default without specifying a boot time value.

boot time values works well only when the number of values that need changing is small.

Joe

#5 lore raw
Quoted 7 lines · Joe Korty
Quoted 1 line

boot time settable is 100x better than only compile time settable imo :)

IMO, everything that is changable at boot time needs an equivalent way of changing the default without specifying a boot time value.

boot time values works well only when the number of values that need changing is small.

Most users will never need to change this /at all/, at boot time, or compile time. Its a corner case for certain hardware configurations. That fits into 'small number of values' afaics.

Dave

#6 lore raw
In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

there are a few devices that use lots of ioremap space. vmalloc space is a showstopper problem for them.

this patch adds the vmalloc=<size> boot parameter to override __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m doubles the size.

Is there a reason for defaulting to such a small allocation even on 4G/4G platforms ?

#7 lore raw
In reply to Ingo Molnar

arch/i386/kernel/setup.c static void __init parse_cmdline_early ( · line 824

Quoted 3 lines · Ingo Molnar
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c.orig +2 -0
+		if (c == ' ' && !memcmp(from, "vmalloc=", 8))
+			__VMALLOC_RESERVE = memparse(from+8, &from);

u o akpm an update to kernel-parameters.txt, please.

#8 lore raw
Quoted 6 lines · Andrew Morton

Review

Quoted 3 lines · Ingo Molnar
(quoted diff) +2 -0
+		if (c == ' ' && !memcmp(from, "vmalloc=", 8))
+			__VMALLOC_RESERVE = memparse(from+8, &from);

u o akpm an update to kernel-parameters.txt, please.

here you go:

kernel-parameters.txt renamed from kernel-parameters.txt.orig +11 -0
@@ -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 <nn>. 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.
 
@@ -1280,6 +1285,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 <nn>. 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]