linux/arch/x86/kernel
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
..
acpi Merge branches 'x86/acpi', 'x86/apic', 'x86/asm', 'x86/cleanups', 'x86/mm', 'x86/signal' and 'x86/urgent'; commit 'v2.6.29-rc6' into x86/core 2009-02-24 21:50:43 +01:00
apic Merge branch 'x86/mce2' into x86/core 2009-03-05 21:49:25 +01:00
cpu 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
.gitignore
Makefile x86: UV, SGI RTC: add UV RTC clocksource/clockevents 2009-03-04 20:25:38 +01:00
alternative.c Merge branch 'x86/core' into x86/mce2 2009-03-03 21:05:42 -08:00
amd_iommu.c AMD IOMMU: remove now unnecessary #ifdefs 2009-01-03 16:44:15 +01:00
amd_iommu_init.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu 2009-01-03 12:03:52 -08:00
aperture_64.c
apm_32.c Merge branch 'linus' into x86/apic 2009-02-22 20:05:19 +01:00
asm-offsets.c
asm-offsets_32.c x86: make lazy %gs optional on x86_32 2009-02-10 00:42:00 +01:00
asm-offsets_64.c x86: remove pda.h 2009-01-20 12:29:20 +09:00
audit_64.c
bios_uv.c x86: bios_uv.c: uv_systab should be static 2008-12-29 22:08:28 -08:00
bootflag.c
check.c
cpuid.c Merge branch 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-03 12:04:39 -08:00
crash.c x86, apic: remove duplicate asm/apic.h inclusions 2009-02-17 17:52:44 +01:00
crash_dump_32.c
crash_dump_64.c
doublefault_32.c
ds.c x86, pebs: correct qualifier passed to ds_write_config() from ds_request_pebs() 2009-03-06 16:13:15 +01:00
dumpstack.c x86: don't pretend that non-framepointer stack traces are reliable 2009-02-09 09:45:29 +01:00
dumpstack.h
dumpstack_32.c
dumpstack_64.c x86-64: Move current task from PDA to per-cpu and consolidate with 32-bit. 2009-01-19 00:38:58 +09:00
e820.c x86: check range in reserve_early() 2009-02-24 22:43:15 +01:00
early-quirks.c x86: only scan the root bus in early PCI quirks 2009-01-09 12:46:22 -08:00
early_printk.c x86: early_printk.c - fix pgtable.h unification fallout 2009-02-09 11:32:17 +01:00
efi.c Merge branch 'linus' into core/percpu 2009-03-11 10:29:28 +01:00
efi_32.c
efi_64.c Merge branch 'linus' into core/percpu 2009-03-11 10:29:28 +01:00
efi_stub_32.S Merge branch 'x86/asm' into x86/mm 2009-02-25 08:27:46 +01:00
efi_stub_64.S x86: efi_stub_32,64 - add missing ENDPROCs 2009-02-24 18:08:40 +01:00
entry_32.S x86: minor cleanup in the espfix code 2009-02-23 11:34:04 -08:00
entry_64.S x86: UV, SGI RTC: add generic system vector 2009-03-04 20:25:37 +01:00
ftrace.c tracing, x86: fix constraint for parent variable 2009-02-11 10:06:13 +01:00
geode_32.c
head.c
head32.c x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
head64.c x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
head_32.S x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
head_64.S x86: head_64.S - use IDT_ENTRIES instead of hardcoded number 2009-02-24 18:08:38 +01:00
hpet.c Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-02-17 14:27:39 -08:00
i386_ksyms_32.c
i387.c x86, math-emu: fix init_fpu for task != current 2009-03-04 20:33:16 +01:00
i8237.c i8327: fix outb() parameter order 2009-02-10 13:13:23 +01:00
i8253.c
i8259.c x86: refactor x86_quirks support 2009-02-23 00:08:11 +01:00
init_task.c take init_fs to saner place 2008-12-31 18:07:42 -05:00
io_delay.c
ioport.c x86-32: use non-lazy io bitmap context switching 2009-03-02 12:07:48 +01:00
irq.c x86: UV, SGI RTC: add generic system vector 2009-03-04 20:25:37 +01:00
irq_32.c Merge branch 'tj-percpu' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into core/percpu 2009-02-24 21:52:45 +01:00
irq_64.c x86: unify do_IRQ() 2009-02-09 12:16:05 +01:00
irqinit_32.c x86: UV, SGI RTC: add generic system vector 2009-03-04 20:25:37 +01:00
irqinit_64.c x86: UV, SGI RTC: add generic system vector 2009-03-04 20:25:37 +01:00
k8.c
kdebugfs.c
kgdb.c x86, apic: remove genapic.h 2009-02-17 17:52:44 +01:00
kprobes.c kprobes: check CONFIG_FREEZER instead of CONFIG_PM 2009-01-16 14:32:17 -05:00
kvm.c
kvmclock.c x86: refactor x86_quirks support 2009-02-23 00:08:11 +01:00
ldt.c x86: ldt.c fix style problems 2009-01-02 17:46:24 +01:00
machine_kexec_32.c x86, kexec: fix kexec x86 coding style 2009-03-10 18:13:25 -07:00
machine_kexec_64.c x86, kexec: x86_64: add kexec jump support for x86_64 2009-03-10 18:13:25 -07:00
mca_32.c x86: refactor x86_quirks support 2009-02-23 00:08:11 +01:00
mfgpt_32.c trivial: fix then -> than typos in comments and documentation 2009-01-06 11:28:06 +01:00
microcode_amd.c
microcode_core.c
microcode_intel.c x86: microcode_intel.c fix style problems 2009-01-12 11:22:40 +01:00
mmconf-fam10h_64.c x86, pci: move arch/x86/pci/pci.h to arch/x86/include/asm/pci_x86.h 2008-12-29 18:17:36 +01:00
module_32.c x86: module_32.c fix style problems 2009-01-12 11:22:55 +01:00
module_64.c x86: module_64.c fix style problems 2009-01-12 11:23:01 +01:00
mpparse.c x86: reserve exact size of mptable 2009-03-04 20:55:04 +01:00
msr.c x86: msr.c fix style problems 2009-01-12 11:22:50 +01:00
olpc.c x86, olpc: fix model detection without OFW 2009-02-14 23:05:25 +01:00
paravirt-spinlocks.c x86: remove byte locks 2009-01-20 17:14:28 +01:00
paravirt.c x86: refactor x86_quirks support 2009-02-23 00:08:11 +01:00
paravirt_patch_32.c x86/pvops: add a paravirt_ident functions to allow special patching 2009-01-30 14:51:44 -08:00
paravirt_patch_64.c x86/pvops: add a paravirt_ident functions to allow special patching 2009-01-30 14:51:44 -08:00
pci-calgary_64.c
pci-dma.c PCI: struct device - replace bus_id with dev_name(), dev_set_name() 2009-01-07 11:12:23 -08:00
pci-gart_64.c Documentation: move DMA-mapping.txt to Doc/PCI/ 2009-01-29 18:19:29 -08:00
pci-nommu.c
pci-swiotlb_64.c Merge branch 'core/iommu' into core/urgent 2009-01-05 14:17:24 +01:00
pcspeaker.c
pmtimer_64.c
probe_roms_32.c x86: move mach-default/*.h files to asm/ 2009-01-29 14:16:51 +01:00
process.c x86: unify chunks of kernel/process*.c 2009-03-02 12:07:48 +01:00
process_32.c x86: unify chunks of kernel/process*.c 2009-03-02 12:07:48 +01:00
process_64.c x86: unify chunks of kernel/process*.c 2009-03-02 12:07:48 +01:00
ptrace.c Merge branches 'x86/apic', 'x86/cpu', 'x86/fixmap', 'x86/mm', 'x86/sched', 'x86/setup-lzma', 'x86/signal' and 'x86/urgent' into x86/core 2009-03-04 02:22:31 +01:00
pvclock.c
quirks.c x86: BUG to BUG_ON changes 2009-03-10 09:55:18 +01:00
reboot.c Merge branch 'linus' into core/percpu 2009-03-11 10:29:28 +01:00
reboot_fixups_32.c
relocate_kernel_32.S x86, kexec: fix kexec x86 coding style 2009-03-10 18:13:25 -07:00
relocate_kernel_64.S x86, kexec: x86_64: add kexec jump support for x86_64 2009-03-10 18:13:25 -07:00
rtc.c
scx200_32.c
setup.c x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
setup_percpu.c percpu: generalize embedding first chunk setup helper 2009-03-10 16:27:48 +09:00
signal.c x86, signals: fix xine & firefox bustage 2009-03-03 09:03:12 +01:00
smp.c x86, apic: remove genapic.h 2009-02-17 17:52:44 +01:00
smpboot.c x86: remove smp_apply_quirks()/smp_checks() 2009-03-08 16:22:56 +01:00
stacktrace.c x86: update copyrights 2009-01-31 04:21:18 +01:00
step.c
sys_i386_32.c
sys_x86_64.c
syscall_64.c
syscall_table_32.S x86: pass in pt_regs pointer for syscalls that need it 2009-02-11 12:40:45 +01:00
tce_64.c
test_nx.c
test_rodata.c
time_32.c x86: refactor x86_quirks support 2009-02-23 00:08:11 +01:00
time_64.c x86: Add IRQF_TIMER to legacy x86 timer interrupt descriptors 2009-02-22 10:27:49 -08:00
tlb_uv.c x86: UV: remove uv_flush_tlb_others() WARN_ON 2009-03-08 11:17:15 +01:00
tls.c
tls.h
topology.c
trampoline.c
trampoline_32.S x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
trampoline_64.S x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
traps.c x86-32: use non-lazy io bitmap context switching 2009-03-02 12:07:48 +01:00
tsc.c x86: replace CONFIG_X86_SMP with CONFIG_SMP 2009-01-29 14:17:00 +01:00
tsc_sync.c
uv_irq.c x86, apic: remove genapic.h 2009-02-17 17:52:44 +01:00
uv_sysfs.c
uv_time.c x86: UV, SGI RTC: fix uv_time.c for UP 2009-03-05 11:27:49 +01:00
verify_cpu_64.S
visws_quirks.c x86: convert obsolete irq_desc_t typedef to struct irq_desc 2009-03-11 09:49:01 +01:00
vm86_32.c x86: use regparm(3) for passed-in pt_regs pointer 2009-02-11 14:00:56 -08:00
vmi_32.c x86, apic: remove genapic.h 2009-02-17 17:52:44 +01:00
vmiclock_32.c Merge branches 'x86/acpi', 'x86/apic', 'x86/asm', 'x86/cleanups', 'x86/mm', 'x86/signal' and 'x86/urgent'; commit 'v2.6.29-rc6' into x86/core 2009-02-24 21:50:43 +01:00
vmlinux.lds.S
vmlinux_32.lds.S x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
vmlinux_64.lds.S x86: add brk allocation for very, very early allocations 2009-03-14 15:37:14 -07:00
vsmp_64.c x86: don't compile vsmp_64 for 32bit 2009-02-26 06:40:06 +01:00
vsyscall_64.c Merge branch 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-12-28 12:21:10 -08:00
x8664_ksyms_64.c x86: convert pda ops to wrappers around x86 percpu accessors 2009-01-16 14:20:22 +01:00
xsave.c x86: xsave.c: restore_user_xstate should be static 2008-12-30 13:31:41 -08:00