diff options
author | 2016-03-15 18:16:47 +0000 | |
---|---|---|
committer | 2016-03-15 18:16:47 +0000 | |
commit | 5c7bcd7eaef67423bb4a9e46c9af663e1c2eb4b0 (patch) | |
tree | 4c7f969e66217f372271db951a2bbc63a8b19bfc | |
parent | For amaps with only a few slots, allocate the slots via pool(9) (diff) | |
download | wireguard-openbsd-5c7bcd7eaef67423bb4a9e46c9af663e1c2eb4b0.tar.xz wireguard-openbsd-5c7bcd7eaef67423bb4a9e46c9af663e1c2eb4b0.zip |
Allocate amap slots for a virtual memory range reserved with sbrk lazily.
This avoids wasting kernel memory if the user process does not make
use of the allocated memory.
Testing by sthen@ and tobiasu@, thanks!
ok deraadt@
-rw-r--r-- | sys/uvm/uvm_unix.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 366a14e986e..505d3c806cd 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.56 2015/05/05 02:13:46 guenther Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.57 2016/03/15 18:16:47 stefan Exp $ */ /* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* @@ -87,7 +87,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval) UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY, MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| - UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); + UVM_FLAG_COPYONW)); if (error) { uprintf("sbrk: grow %ld failed, error = %d\n", new - old, error); |