Subject: CVS commit: src
To: None <source-changes@netbsd.org>
From: Andrew Brown <atatat@netbsd.org>
List: source-changes
Date: 02/21/2003 00:16:09
Module Name:	src
Committed By:	atatat
Date:		Thu Feb 20 22:16:09 UTC 2003

Modified Files:
	src/share/man/man4: options.4
	src/sys/arch/hp300/dev: grf.c
	src/sys/arch/i386/include: vmparam.h
	src/sys/arch/mac68k/dev: grf_compat.c
	src/sys/arch/pmax/dev: px.c qvss_compat.c
	src/sys/arch/x68k/dev: grf.c
	src/sys/conf: files
	src/sys/kern: exec_elf32.c exec_subr.c sysv_shm.c
	src/sys/sys: exec.h
	src/sys/uvm: uvm_map.c uvm_map.h uvm_mmap.c uvm_param.h

Log Message:
Introduce "top down" memory management for mmap()ed allocations.  This
means that the dynamic linker gets mapped in at the top of available
user virtual memory (typically just below the stack), shared libraries
get mapped downwards from that point, and calls to mmap() that don't
specify a preferred address will get mapped in below those.

This means that the heap and the mmap()ed allocations will grow
towards each other, allowing one or the other to grow larger than
before.  Previously, the heap was limited to MAXDSIZ by the placement
of the dynamic linker (and the process's rlimits) and the space
available to mmap was hobbled by this reservation.

This is currently only enabled via an *option* for the i386 platform
(though other platforms are expected to follow).  Add "options
USE_TOPDOWN_VM" to your kernel config file, rerun config, and rebuild
your kernel to take advantage of this.

Note that the pmap_prefer() interface has not yet been modified to
play nicely with this, so those platforms require a bit more work
(most notably the sparc) before they can use this new memory
arrangement.

This change also introduces a VM_DEFAULT_ADDRESS() macro that picks
the appropriate default address based on the size of the allocation or
the size of the process's text segment accordingly.  Several drivers
and the SYSV SHM address assignment were changed to use this instead
of each one picking their own "default".


To generate a diff of this commit:
cvs rdiff -r1.195 -r1.196 src/share/man/man4/options.4
cvs rdiff -r1.49 -r1.50 src/sys/arch/hp300/dev/grf.c
cvs rdiff -r1.47 -r1.48 src/sys/arch/i386/include/vmparam.h
cvs rdiff -r1.10 -r1.11 src/sys/arch/mac68k/dev/grf_compat.c
cvs rdiff -r1.45 -r1.46 src/sys/arch/pmax/dev/px.c
cvs rdiff -r1.31 -r1.32 src/sys/arch/pmax/dev/qvss_compat.c
cvs rdiff -r1.24 -r1.25 src/sys/arch/x68k/dev/grf.c
cvs rdiff -r1.600 -r1.601 src/sys/conf/files
cvs rdiff -r1.79 -r1.80 src/sys/kern/exec_elf32.c
cvs rdiff -r1.33 -r1.34 src/sys/kern/exec_subr.c
cvs rdiff -r1.67 -r1.68 src/sys/kern/sysv_shm.c
cvs rdiff -r1.92 -r1.93 src/sys/sys/exec.h
cvs rdiff -r1.130 -r1.131 src/sys/uvm/uvm_map.c
cvs rdiff -r1.33 -r1.34 src/sys/uvm/uvm_map.h
cvs rdiff -r1.67 -r1.68 src/sys/uvm/uvm_mmap.c
cvs rdiff -r1.13 -r1.14 src/sys/uvm/uvm_param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.