]> git.ipfire.org Git - thirdparty/man-pages.git/commit
mmap.2: Fix description of treatment of the hint
authorJann Horn <jannh@google.com>
Thu, 14 Feb 2019 16:18:36 +0000 (17:18 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 25 Feb 2019 14:56:54 +0000 (15:56 +0100)
commitf58e9ed09274f7a81394d7eef262baefd2ec3164
tree089e628b97b6f80dae82df0ff175b59348ad6a94
parentc4b7b812d350889e4697c38ee590fb8c3eea24d0
mmap.2: Fix description of treatment of the hint

The current manpage reads to me as if the kernel will always pick
a free space close to the requested address, but that's not the
case:

mmap(0x600000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x600000000000
mmap(0x600000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5042859000

You can also see this in the various implementations of
->get_unmapped_area() - if the specified address isn't available,
the kernel basically ignores the hint (apart from the 5level
paging hack).

Clarify how this works a bit.

Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/mmap.2