diff options
author | 2011-05-24 15:27:36 +0000 | |
---|---|---|
committer | 2011-05-24 15:27:36 +0000 | |
commit | 4e3da9ea5c5c5f4e31e57e65a6f97720cfa2a93f (patch) | |
tree | d9bb5c2f86c9031ede4e5ba19468f965cd1ce33e /sys/kern/kern_malloc.c | |
parent | Merge pf_scrub_ip() and pf_scrub_ip6() into a single function. Call (diff) | |
download | wireguard-openbsd-4e3da9ea5c5c5f4e31e57e65a6f97720cfa2a93f.tar.xz wireguard-openbsd-4e3da9ea5c5c5f4e31e57e65a6f97720cfa2a93f.zip |
Reimplement uvm/uvm_map.
vmmap is designed to perform address space randomized allocations,
without letting fragmentation of the address space go through the roof.
Some highlights:
- kernel address space randomization
- proper implementation of guardpages
- roughly 10% system time reduction during kernel build
Tested by alot of people on tech@ and developers.
Theo's machines are still happy.
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r-- | sys/kern/kern_malloc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 9660ca1d297..cfdfe419efd 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.86 2010/09/26 21:03:56 tedu Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.87 2011/05/24 15:27:36 ariane Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -576,8 +576,13 @@ kmeminit(void) kmeminit_nkmempages(); base = vm_map_min(kernel_map); kmem_map = uvm_km_suballoc(kernel_map, &base, &limit, - (vsize_t)(nkmempages * PAGE_SIZE), VM_MAP_INTRSAFE, FALSE, - &kmem_map_store); + (vsize_t)(nkmempages * PAGE_SIZE), +#ifdef KVA_GUARDPAGES + VM_MAP_INTRSAFE | VM_MAP_GUARDPAGES, +#else + VM_MAP_INTRSAFE, +#endif + FALSE, &kmem_map_store); kmembase = (char *)base; kmemlimit = (char *)limit; kmemusage = (struct kmemusage *) uvm_km_zalloc(kernel_map, |