linux/arch/x86
Jeremy Fitzhardinge 93dbda7cbc x86: add brk allocation for very, very early allocations
Impact: new interface

Add a brk()-like allocator which effectively extends the bss in order
to allow very early code to do dynamic allocations.  This is better than
using statically allocated arrays for data in subsystems which may never
get used.

The space for brk allocations is in the bss ELF segment, so that the
space is mapped properly by the code which maps the kernel, and so
that bootloaders keep the space free rather than putting a ramdisk or
something into it.

The bss itself, delimited by __bss_stop, ends before the brk area
(__brk_base to __brk_limit).  The kernel text, data and bss is reserved
up to __bss_stop.

Any brk-allocated data is reserved separately just before the kernel
pagetable is built, as that code allocates from unreserved spaces
in the e820 map, potentially allocating from any unused brk memory.
Ultimately any unused memory in the brk area is used in the general
kernel memory pool.

Initially the brk space is set to 1MB, which is probably much larger
than any user needs (the largest current user is i386 head_32.S's code
to build the pagetables to map the kernel, which can get fairly large
with a big kernel image and no PSE support).  So long as the system
has sufficient memory for the bootloader to reserve the kernel+1MB brk,
there are no bad effects resulting from an over-large brk.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-03-14 15:37:14 -07:00
..
boot x86: remove zImage support 2009-03-11 11:00:00 -07:00
configs Merge branches 'x86/apic', 'x86/defconfig', 'x86/memtest', 'x86/mm' and 'linus' into x86/core 2009-02-26 06:31:32 +01:00
crypto crypto: crc32c-intel - Switch to shash 2008-12-25 11:01:37 +11:00
ia32 x86: ia32_signal: introduce {get|set}_user_seg() 2009-02-22 17:54:47 +01:00
include/asm x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
kernel x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
kvm KVM: VMX: Flush volatile msrs before emulating rdmsr 2009-02-15 02:47:39 +02:00
lguest Merge branches 'x86/cleanups', 'x86/kexec', 'x86/mce2' and 'linus' into x86/core 2009-03-11 10:49:15 +01:00
lib x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
math-emu Merge branch 'linus' into core/percpu 2009-03-11 10:29:28 +01:00
mm x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
oprofile x86: oprofile: don't set counter width from cpuid on Core2 2009-03-03 12:04:22 +01:00
pci x86, apic: remove genapic.h 2009-02-17 17:52:44 +01:00
power x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
vdso x86, mm: rename TASK_SIZE64 => TASK_SIZE_MAX 2009-02-21 00:09:44 +01:00
video
xen x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
Kconfig Merge branches 'x86/asm', 'x86/debug', 'x86/mm', 'x86/setup', 'x86/urgent' and 'linus' into x86/core 2009-03-12 11:50:15 +01:00
Kconfig.cpu Merge branch 'x86/urgent' into core/percpu 2009-02-10 00:41:02 +01:00
Kconfig.debug Merge branch 'linus' into x86/apic 2009-02-22 20:05:19 +01:00
Makefile Merge branch 'core/percpu' into x86/core 2009-02-13 09:45:09 +01:00
Makefile_32.cpu