diff options
author | jeff <jeff@FreeBSD.org> | 2002-03-19 09:11:49 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-03-19 09:11:49 +0000 |
commit | 2923687da3c046deea227e675d5af075b9fa52d4 (patch) | |
tree | 9added529dcba41e3e9f6e15e334a8a06d6cb0f2 /sys/sparc64 | |
parent | d95a4801fc26e963b0da94ad73f00ce63c5ed657 (diff) | |
download | FreeBSD-src-2923687da3c046deea227e675d5af075b9fa52d4.zip FreeBSD-src-2923687da3c046deea227e675d5af075b9fa52d4.tar.gz |
This is the first part of the new kernel memory allocator. This replaces
malloc(9) and vm_zone with a slab like allocator.
Reviewed by: arch@
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/include/pv.h | 1 | ||||
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 10 | ||||
-rw-r--r-- | sys/sparc64/sparc64/pv.c | 10 |
3 files changed, 21 insertions, 0 deletions
diff --git a/sys/sparc64/include/pv.h b/sys/sparc64/include/pv.h index 44262a5..732ef03 100644 --- a/sys/sparc64/include/pv.h +++ b/sys/sparc64/include/pv.h @@ -48,6 +48,7 @@ extern int pv_entry_max; extern int pv_entry_high_water; extern struct pv_entry *pvinit; +void *pv_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); pv_entry_t pv_alloc(void); void pv_free(pv_entry_t pv); diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 8efc097..3323861 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -543,11 +543,17 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) panic("pmap_init: vm_map_find"); } +#if 0 pvzone = &pvzone_store; pvinit = (struct pv_entry *)kmem_alloc(kernel_map, vm_page_array_size * sizeof (struct pv_entry)); zbootinit(pvzone, "PV ENTRY", sizeof (struct pv_entry), pvinit, vm_page_array_size); +#else + pvzone = zinit("PV ENTRY", sizeof (struct pv_entry), 0, 0, 0); + uma_zone_set_allocf(pvzone, pv_allocf); + uma_prealloc(pvzone, vm_page_array_size); +#endif pmap_initialized = TRUE; } @@ -565,7 +571,11 @@ pmap_init2(void) TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc); pv_entry_max = shpgperproc * maxproc + vm_page_array_size; pv_entry_high_water = 9 * (pv_entry_max / 10); +#if 0 zinitna(pvzone, &pvzone_obj, NULL, 0, pv_entry_max, ZONE_INTERRUPT, 1); +#else + uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max); +#endif } /* diff --git a/sys/sparc64/sparc64/pv.c b/sys/sparc64/sparc64/pv.c index c970630..1b3b2ed 100644 --- a/sys/sparc64/sparc64/pv.c +++ b/sys/sparc64/sparc64/pv.c @@ -61,7 +61,9 @@ #include <machine/tsb.h> vm_zone_t pvzone; +#if 0 struct vm_zone pvzone_store; +#endif struct vm_object pvzone_obj; int pv_entry_count; int pv_entry_max; @@ -81,6 +83,14 @@ pv_alloc(void) return (zalloc(pvzone)); } +void * +pv_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + + *flags = UMA_SLAB_PRIV; + return (void *)kmem_alloc(kernel_map, bytes); +} + void pv_free(pv_entry_t pv) { |