diff options
author | jeff <jeff@FreeBSD.org> | 2002-11-01 01:01:27 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-11-01 01:01:27 +0000 |
commit | b7d774ad9792415680529ff3b980c782e6017d69 (patch) | |
tree | 2eaec5a81b820f60cca88f0d1bbeb299a7a70112 /sys/vm | |
parent | 827f7f802d6c9bb6e26502be3f21dc7aa7ce254e (diff) | |
download | FreeBSD-src-b7d774ad9792415680529ff3b980c782e6017d69.zip FreeBSD-src-b7d774ad9792415680529ff3b980c782e6017d69.tar.gz |
- Add support for machine dependant page allocation routines. MD code
may define UMA_MD_SMALL_ALLOC to make use of this feature.
Reviewed by: peter, jake
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/uma_core.c | 22 | ||||
-rw-r--r-- | sys/vm/uma_int.h | 8 |
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 18e9442..8864150 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -81,6 +81,8 @@ #include <vm/uma_int.h> #include <vm/uma_dbg.h> +#include <machine/vmparam.h> + /* * This is the zone from which all zones are spawned. The idea is that even * the zone heads are allocated from the allocator, so we use the bss section @@ -633,10 +635,17 @@ finished: if (zone->uz_flags & UMA_ZFLAG_OFFPAGE) uma_zfree_internal(slabzone, slab, NULL, 0); - if (zone->uz_flags & UMA_ZFLAG_MALLOC) + if (zone->uz_flags & UMA_ZFLAG_MALLOC) { + vm_object_t obj; + + if (flags & UMA_SLAB_KMEM) + obj = kmem_object; + else + obj = NULL; for (i = 0; i < zone->uz_ppera; i++) vsetobj((vm_offset_t)mem + (i * PAGE_SIZE), - kmem_object); + obj); + } #ifdef UMA_DEBUG printf("%s: Returning %d bytes.\n", zone->uz_name, UMA_SLAB_SIZE * zone->uz_ppera); @@ -1005,6 +1014,12 @@ zone_ctor(void *mem, int size, void *udata) zone_large_init(zone); else zone_small_init(zone); +#ifdef UMA_MD_SMALL_ALLOC + if (zone->uz_ppera == 1) { + zone->uz_allocf = uma_small_alloc; + zone->uz_freef = uma_small_free; + } +#endif /* UMA_MD_SMALL_ALLOC */ if (arg->flags & UMA_ZONE_MTXCLASS) privlc = 1; @@ -1228,6 +1243,9 @@ uma_startup(void *bootmem) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_INTERNAL); +#ifdef UMA_MD_SMALL_ALLOC + booted = 1; +#endif #ifdef UMA_DEBUG printf("UMA startup complete.\n"); diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h index 77082d3..ce4054f 100644 --- a/sys/vm/uma_int.h +++ b/sys/vm/uma_int.h @@ -374,4 +374,12 @@ vsetobj(vm_offset_t va, vm_object_t obj) p->flags &= ~PG_SLAB; } +/* + * The following two functions may be defined by architecture specific code + * if they can provide more effecient allocation functions. This is useful + * for using direct mapped addresses. + */ +void *uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *pflag, int wait); +void uma_small_free(void *mem, int size, u_int8_t flags); + #endif /* VM_UMA_INT_H */ |