diff options
author | green <green@FreeBSD.org> | 2004-08-02 00:18:36 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-08-02 00:18:36 +0000 |
commit | 9532ab7116a36e60ae15ec463c757a7d2e7f9b39 (patch) | |
tree | ff53102435294d83e0ddcbd011824aa65f84e3c8 /sys/vm/vm_map.c | |
parent | 14a50c4ac0247a8950847156b4fc16cf935c14ca (diff) | |
download | FreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.zip FreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.tar.gz |
* Add a "how" argument to uma_zone constructors and initialization functions
so that they know whether the allocation is supposed to be able to sleep
or not.
* Allow uma_zone constructors and initialation functions to return either
success or error. Almost all of the ones in the tree currently return
success unconditionally, but mbuf is a notable exception: the packet
zone constructor wants to be able to fail if it cannot suballocate an
mbuf cluster, and the mbuf allocators want to be able to fail in general
in a MAC kernel if the MAC mbuf initializer fails. This fixes the
panics people are seeing when they run out of memory for mbuf clusters.
* Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing
the default.
Both bmilekic and jeff have reviewed the changes made to make failable
zone allocations work.
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index baacf70..26c8d62 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -137,9 +137,9 @@ static uma_zone_t kmapentzone; static uma_zone_t mapzone; static uma_zone_t vmspace_zone; static struct vm_object kmapentobj; -static void vmspace_zinit(void *mem, int size); +static int vmspace_zinit(void *mem, int size, int flags); static void vmspace_zfini(void *mem, int size); -static void vm_map_zinit(void *mem, int size); +static int vm_map_zinit(void *mem, int ize, int flags); static void vm_map_zfini(void *mem, int size); static void _vm_map_init(vm_map_t map, vm_offset_t min, vm_offset_t max); @@ -179,15 +179,16 @@ vmspace_zfini(void *mem, int size) vm_map_zfini(&vm->vm_map, sizeof(vm->vm_map)); } -static void -vmspace_zinit(void *mem, int size) +static int +vmspace_zinit(void *mem, int size, int flags) { struct vmspace *vm; vm = (struct vmspace *)mem; - vm_map_zinit(&vm->vm_map, sizeof(vm->vm_map)); + (void)vm_map_zinit(&vm->vm_map, sizeof(vm->vm_map), flags); pmap_pinit(vmspace_pmap(vm)); + return (0); } static void @@ -200,8 +201,8 @@ vm_map_zfini(void *mem, int size) sx_destroy(&map->lock); } -static void -vm_map_zinit(void *mem, int size) +static int +vm_map_zinit(void *mem, int size, int flags) { vm_map_t map; @@ -211,6 +212,7 @@ vm_map_zinit(void *mem, int size) map->infork = 0; mtx_init(&map->system_mtx, "system map", NULL, MTX_DEF | MTX_DUPOK); sx_init(&map->lock, "user map"); + return (0); } #ifdef INVARIANTS |