diff options
author | jeff <jeff@FreeBSD.org> | 2002-03-20 04:02:59 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-03-20 04:02:59 +0000 |
commit | 9ef9bf2eafae98b3e22da0b2e655ede34057de17 (patch) | |
tree | 1e883c02c1bb30635d6a0ff508ddb7d597b21997 | |
parent | 8c4c86de23351a059da32e84dccff0bbbc8d3c48 (diff) | |
download | FreeBSD-src-9ef9bf2eafae98b3e22da0b2e655ede34057de17.zip FreeBSD-src-9ef9bf2eafae98b3e22da0b2e655ede34057de17.tar.gz |
Remove references to vm_zone.h and switch over to the new uma API.
-rw-r--r-- | sys/vm/default_pager.c | 1 | ||||
-rw-r--r-- | sys/vm/device_pager.c | 18 | ||||
-rw-r--r-- | sys/vm/phys_pager.c | 1 | ||||
-rw-r--r-- | sys/vm/swap_pager.c | 24 | ||||
-rw-r--r-- | sys/vm/swap_pager.h | 2 | ||||
-rw-r--r-- | sys/vm/vm_init.c | 1 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 8 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 10 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 2 | ||||
-rw-r--r-- | sys/vm/vm_swap.c | 2 |
10 files changed, 30 insertions, 39 deletions
diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index c3854ab..40b9581 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -49,7 +49,6 @@ #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <vm/vm_zone.h> #include <vm/swap_pager.h> static vm_object_t default_pager_alloc(void *, vm_ooffset_t, vm_prot_t, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index e4e5591..749f2f0 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -52,7 +52,7 @@ #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <vm/vm_zone.h> +#include <vm/uma.h> static void dev_pager_init(void); static vm_object_t dev_pager_alloc(void *, vm_ooffset_t, vm_prot_t, @@ -72,10 +72,7 @@ static struct sx dev_pager_sx; static struct mtx dev_pager_mtx; -static vm_zone_t fakepg_zone; -#if 0 -static struct vm_zone fakepg_zone_store; -#endif +static uma_zone_t fakepg_zone; static vm_page_t dev_pager_getfake(vm_offset_t); static void dev_pager_putfake(vm_page_t); @@ -96,11 +93,8 @@ dev_pager_init() TAILQ_INIT(&dev_pager_object_list); sx_init(&dev_pager_sx, "dev_pager create"); mtx_init(&dev_pager_mtx, "dev_pager list", MTX_DEF); -#if 0 - fakepg_zone = &fakepg_zone_store; - zinitna(fakepg_zone, NULL, "DP fakepg", sizeof(struct vm_page), 0, 0, 2); -#endif - fakepg_zone = zinit("DP fakepg", sizeof(struct vm_page), 0, 0, 0); + fakepg_zone = uma_zcreate("DP fakepg", sizeof(struct vm_page), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); } static vm_object_t @@ -265,7 +259,7 @@ dev_pager_getfake(paddr) { vm_page_t m; - m = zalloc(fakepg_zone); + m = uma_zalloc(fakepg_zone, M_WAITOK); m->flags = PG_BUSY | PG_FICTITIOUS; m->valid = VM_PAGE_BITS_ALL; @@ -287,5 +281,5 @@ dev_pager_putfake(m) { if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_putfake: bad page"); - zfree(fakepg_zone, m); + uma_zfree(fakepg_zone, m); } diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index 8ac32d0..e5e3413 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -40,7 +40,6 @@ #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <vm/vm_zone.h> /* prevent concurrant creation races */ static int phys_pager_alloc_lock; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index a6552d9..778767e 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -98,9 +98,9 @@ #include <vm/vm_page.h> #include <vm/vm_pager.h> #include <vm/vm_pageout.h> -#include <vm/vm_zone.h> #include <vm/swap_pager.h> #include <vm/vm_extern.h> +#include <vm/uma.h> #define SWM_FREE 0x02 /* free, period */ #define SWM_POP 0x04 /* pop out */ @@ -148,7 +148,7 @@ SYSCTL_INT(_vm, OID_AUTO, swap_async_max, static struct mtx sw_alloc_mtx; /* protect list manipulation */ static struct pagerlst swap_pager_object_list[NOBJLISTS]; struct pagerlst swap_pager_un_object_list; -vm_zone_t swap_zone; +uma_zone_t swap_zone; /* * pagerops for OBJT_SWAP - "swap pager". Some ops are also global procedure @@ -320,13 +320,8 @@ swap_pager_swap_init() if (maxswzone && n > maxswzone / sizeof(struct swblock)) n = maxswzone / sizeof(struct swblock); n2 = n; - swap_zone = zinit( - "SWAPMETA", - sizeof(struct swblock), - n, - ZONE_INTERRUPT, - 1 - ); + swap_zone = uma_zcreate("SWAPMETA", sizeof(struct swblock), NULL, NULL, + NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); do { if (uma_zone_set_obj(swap_zone, NULL, n)) break; @@ -337,7 +332,7 @@ swap_pager_swap_init() n -= ((n + 2) / 3); } while (n > 0); if (swap_zone == NULL) - panic("failed to zinit swap_zone."); + panic("failed to create swap_zone."); if (n2 != n) printf("Swap zone entries reduced from %d to %d.\n", n2, n); n2 = n; @@ -1727,11 +1722,12 @@ retry: if (swapblk == SWAPBLK_NONE) return; - swap = *pswap = zalloc(swap_zone); + swap = *pswap = uma_zalloc(swap_zone, M_NOWAIT); if (swap == NULL) { VM_WAIT; goto retry; } + swap->swb_hnext = NULL; swap->swb_object = object; swap->swb_index = index & ~SWAP_META_MASK; @@ -1796,7 +1792,7 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count) SWAPBLK_NONE; if (--swap->swb_count == 0) { *pswap = swap->swb_hnext; - zfree(swap_zone, swap); + uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; } } @@ -1846,7 +1842,7 @@ swp_pager_meta_free_all(vm_object_t object) if (swap->swb_count != 0) panic("swap_pager_meta_free_all: swb_count != 0"); *pswap = swap->swb_hnext; - zfree(swap_zone, swap); + uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; } index += SWAP_META_PAGES; @@ -1911,7 +1907,7 @@ swp_pager_meta_ctl( swap->swb_pages[index] = SWAPBLK_NONE; if (--swap->swb_count == 0) { *pswap = swap->swb_hnext; - zfree(swap_zone, swap); + uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; } } diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index b028ecb..a6918bb 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -82,7 +82,7 @@ struct swblock { extern struct pagerlst swap_pager_un_object_list; extern int swap_pager_full; extern struct blist *swapblist; -extern vm_zone_t swap_zone; +extern uma_zone_t swap_zone; void swap_pager_putpages(vm_object_t, vm_page_t *, int, boolean_t, int *); boolean_t swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *after); diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c index 7230855..1079e1b 100644 --- a/sys/vm/vm_init.c +++ b/sys/vm/vm_init.c @@ -85,7 +85,6 @@ #include <vm/vm_map.h> #include <vm/vm_pager.h> #include <vm/vm_extern.h> -#include <vm/vm_zone.h> /* * System initialization diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 0c6c84f..0fc76a3 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -89,6 +89,7 @@ #include <vm/vm_kern.h> #include <vm/vm_extern.h> #include <vm/swap_pager.h> +#include <vm/uma.h> /* * Virtual memory maps provide for the mapping, protection, @@ -157,8 +158,11 @@ vm_map_startup(void) #endif vm_map_zinit, vm_map_zfini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); uma_prealloc(mapzone, MAX_KMAP); - kmapentzone = zinit("KMAP ENTRY", sizeof(struct vm_map_entry), 0, 0, 0); uma_prealloc(kmapentzone, MAX_KMAPENT); - mapentzone = zinit("MAP ENTRY", sizeof(struct vm_map_entry), 0, 0, 0); + kmapentzone = uma_zcreate("KMAP ENTRY", sizeof(struct vm_map_entry), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_prealloc(kmapentzone, MAX_KMAPENT); + mapentzone = uma_zcreate("MAP ENTRY", sizeof(struct vm_map_entry), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_prealloc(mapentzone, MAX_MAPENT); } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index e6f1ad5..68bd1dd 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -90,10 +90,10 @@ #include <vm/vm_page.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> -#include <vm/vm_zone.h> #include <vm/swap_pager.h> #include <vm/vm_kern.h> #include <vm/vm_extern.h> +#include <vm/uma.h> #define EASY_SCAN_FACTOR 8 @@ -148,7 +148,7 @@ static long object_collapses; static long object_bypasses; static int next_index; static int object_hash_rand; -static vm_zone_t obj_zone; +static uma_zone_t obj_zone; #define VM_OBJECTS_INIT 256 static void vm_object_zinit(void *mem, int size); @@ -347,7 +347,7 @@ vm_object_allocate(objtype_t type, vm_size_t size) GIANT_REQUIRED; - result = (vm_object_t) zalloc(obj_zone); + result = (vm_object_t) uma_zalloc(obj_zone, M_WAITOK); _vm_object_allocate(type, size, result); return (result); @@ -605,7 +605,7 @@ vm_object_terminate(vm_object_t object) /* * Free the space for the object. */ - zfree(obj_zone, object); + uma_zfree(obj_zone, object); } /* @@ -1517,7 +1517,7 @@ vm_object_collapse(vm_object_t object) object_list ); - zfree(obj_zone, backing_object); + uma_zfree(obj_zone, backing_object); object_collapses++; } else { diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 3489cc3..23e94f2 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -95,9 +95,9 @@ #include <vm/vm_map.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> -#include <vm/vm_zone.h> #include <vm/swap_pager.h> #include <vm/vm_extern.h> +#include <vm/uma.h> #include <machine/mutex.h> diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index a79a8e2..ac775be 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -54,9 +54,9 @@ #include <sys/sysctl.h> #include <vm/vm.h> #include <vm/vm_extern.h> -#include <vm/vm_zone.h> #include <vm/vm_param.h> #include <vm/swap_pager.h> +#include <vm/uma.h> /* * Indirect driver for multi-controller paging. |