freebsd-skq/sys/vm
kib 91d820a4f9 Treat the addr argument for mmap(2) request without MAP_FIXED flag as
a hint.

Right now, for non-fixed mmap(2) calls, addr is de-facto interpreted
as the absolute minimal address of the range where the mapping is
created.  The VA allocator only allocates in the range [addr,
VM_MAXUSER_ADDRESS].  This is too restrictive, the mmap(2) call might
unduly fail if there is no free addresses above addr but a lot of
usable space below it.

Lift this implementation limitation by allocating VA in two passes.
First, try to allocate above addr, as before.  If that fails, do the
second pass with less restrictive constraints for the start of
allocation by specifying minimal allocation address at the max bss
end, if this limit is less than addr.

One important case where this change makes a difference is the
allocation of the stacks for new threads in libthr.  Under some
configuration conditions, libthr tries to hint kernel to reuse the
main thread stack grow area for the new stacks.  This cannot work by
design now after grow area is converted to stack, and there is no
unallocated VA above the main stack.  Interpreting requested stack
base address as the hint provides compatibility with old libthr and
with (mis-)configured current libthr.

Reviewed by:	alc
Tested by:	dim (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-06-28 04:02:36 +00:00
..
_vm_radix.h
default_pager.c
device_pager.c
memguard.c
memguard.h
phys_pager.c
pmap.h
redzone.c
redzone.h
sg_pager.c
swap_pager.c Increase the pageout cluster size to 32 pages. 2017-06-24 17:10:33 +00:00
swap_pager.h
uma_core.c When we are in UMA_STARTUP use startup_alloc() for any zone, not for 2017-06-08 21:33:19 +00:00
uma_dbg.c
uma_dbg.h
uma_int.h
uma.h
vm_domain.c
vm_domain.h
vm_extern.h
vm_fault.c Implement address space guards. 2017-06-24 17:01:11 +00:00
vm_glue.c
vm_init.c
vm_kern.c
vm_kern.h
vm_map.c Treat the addr argument for mmap(2) request without MAP_FIXED flag as 2017-06-28 04:02:36 +00:00
vm_map.h Treat the addr argument for mmap(2) request without MAP_FIXED flag as 2017-06-28 04:02:36 +00:00
vm_meter.c
vm_mmap.c Treat the addr argument for mmap(2) request without MAP_FIXED flag as 2017-06-28 04:02:36 +00:00
vm_object.c
vm_object.h
vm_page.c Fix an off-by-one error in the VM page array on some systems. 2017-06-08 16:18:41 +00:00
vm_page.h
vm_pageout.c Increase the pageout cluster size to 32 pages. 2017-06-24 17:10:33 +00:00
vm_pageout.h
vm_pager.c
vm_pager.h
vm_param.h
vm_phys.c
vm_phys.h
vm_radix.c
vm_radix.h
vm_reserv.c
vm_reserv.h
vm_unix.c
vm.h Implement address space guards. 2017-06-24 17:01:11 +00:00
vnode_pager.c Some minor improvements to vnode_pager_generic_putpages(). 2017-06-15 14:34:33 +00:00
vnode_pager.h