[PATCH] i386 ramdisk_max fix for < 1GB kernel space

From: John Cho
Date: Sun Feb 13 2005 - 15:13:59 EST


There was a vmalloc tuning patch made back in September 2004 that reserved a larger amount of memory for vmalloc. Unfortunately, the patch does not work properly for modified kernels where the kernel's virtual address space has been reduced to 512MB or less.

More specifically, if __PAGE_OFFSET is set to 0xE0000000 (reducing the kernel's virtual address space to 512MB), then the code:

ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff

results in a ramdisk_max of 0x7fffffff which is out of bounds. The patch is to change the above code to:

ramdisk_max: .long (((-__PAGE_OFFSET) / 2) - 1) & 0x7fffffff

This keeps the spirit of the original patch and reserves 512MB of space for vmalloc when __PAGE_OFFSET is not modified (0xc0000000). If __PAGE_OFFSET is lowered (increasing the kernel's virtual address space), more vmalloc space is proportionally reserved. If __PAGE_OFFSET is increased (my case), less vmalloc space is reserved.



Signed-off-by: John Cho <jcho@xxxxxxxxxxxx>

--- linux-2.6.10.orig/arch/i386/boot/setup.S 2004-12-24 13:34:58.000000000 -0800
+++ linux-2.6.10/arch/i386/boot/setup.S 2005-02-13 10:34:27.413862125 -0800
@@ -156,7 +156,7 @@
# can be located anywhere in
# low memory 0x10000 or higher.

-ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
+ramdisk_max: .long (((-__PAGE_OFFSET) / 2) - 1) & 0x7fffffff
# (Header version 0x0203 or later)
# The highest safe address for
# the contents of an initrd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/