Remove references to vm_zone.h and switch over to the new uma API.
This commit is contained in:
parent
96abb1618a
commit
670d17b5c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92748
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 @@ swp_pager_meta_build(
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user