diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-03-12 16:09:49 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-03-14 17:23:47 -0700 |
commit | 796216a57fe45c04adc35bda1f0782efec78a713 (patch) | |
tree | 7f94407dfa2ccc2ab7a8e2b3e09cee04290f0ca1 /arch/x86/kernel/vmlinux_64.lds.S | |
parent | 7543c1de84ed93c6769c9f20dced08a522af8912 (diff) | |
download | lwn-796216a57fe45c04adc35bda1f0782efec78a713.tar.gz lwn-796216a57fe45c04adc35bda1f0782efec78a713.zip |
x86: allow extend_brk users to reserve brk space
Impact: new interface; remove hard-coded limit
Add RESERVE_BRK(name, size) macro to reserve space in the brk
area. This should be a conservative (ie, larger) estimate of
how much space might possibly be required from the brk area.
Any unused space will be freed, so there's no real downside
on making the reservation too large (within limits).
The name should be unique within a given file, and somewhat
descriptive.
The C definition of RESERVE_BRK() ends up being more complex than
one would expect to work around a cluster of gcc infelicities:
The first attempt was to simply try putting __section(.brk_reservation)
on a variable. This doesn't work because it ends up making it a
@progbits section, which gets actual space allocated in the vmlinux
executable.
The second attempt was to emit the space into a section using asm,
but gcc doesn't allow arguments to be passed to file-level asm()
statements, making it hard to pass in the size.
The final attempt is to wrap the asm() in a function to allow
it to have arguments, and put the function itself into the
.discard section, which vmlinux*.lds drops entirely from the
emitted vmlinux.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/vmlinux_64.lds.S')
-rw-r--r-- | arch/x86/kernel/vmlinux_64.lds.S | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S index ff373423138c..7996687663a2 100644 --- a/arch/x86/kernel/vmlinux_64.lds.S +++ b/arch/x86/kernel/vmlinux_64.lds.S @@ -250,7 +250,8 @@ SECTIONS . = ALIGN(PAGE_SIZE); __brk_base = . ; - . += 1024 * 1024 ; + . += 64 * 1024; /* 64k slop space */ + *(.brk_reservation) /* areas brk users have reserved */ __brk_limit = . ; } @@ -260,6 +261,7 @@ SECTIONS /DISCARD/ : { *(.exitcall.exit) *(.eh_frame) + *(.discard) } STABS_DEBUG |