]> git.hungrycats.org Git - linux/commit
[PATCH] Use address hint in mmap for search
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:49:14 +0000 (18:49 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:49:14 +0000 (18:49 -0800)
commited20552072b113ab3dfc10ff153b1274f3befc94
tree223a1fdafd89c99674684c34fa5030c297d37e25
parentc7f6fcf55b7ce3cf61e0953a18e0ab9e70421a47
[PATCH] Use address hint in mmap for search

From: Andi Kleen <ak@suse.de>

When the user gave an address hint in mmap use it as starting point for the
search for !MAP_FIXED.

Currently it is only checked directly and when already used the free area
cache is used as starting point.  With this change you can use mmap(4096,
....) to e.g.  get the lowest free address in your address space, which is
sometimes useful.  For example on x86-64 glibc wants to preferably allocate
thread local data in the first 4GB but use higher addresses when this is
not possible.

This can be a bit more costly in CPU time because it may have to skip over
more VMAs, but gives better semantics for most cases.  Most programs pass
NULL as hint anyways so it won't make any difference for them.

I did it for the generic mmap and for x86-64 for now.  Also minor white
space fixes for x86-64.
arch/x86_64/kernel/sys_x86_64.c
mm/mmap.c