| version 1.97, 2005/01/01 21:04:39 |
version 1.98, 2005/01/01 21:08:02 |
| Line 82 static struct pool phpool[PHPOOL_MAX]; |
|
| Line 82 static struct pool phpool[PHPOOL_MAX]; |
|
| static struct pool psppool; |
static struct pool psppool; |
| #endif |
#endif |
| |
|
| |
static void *pool_page_alloc_meta(struct pool *, int); |
| |
static void pool_page_free_meta(struct pool *, void *); |
| |
|
| |
/* allocator for pool metadata */ |
| |
static struct pool_allocator pool_allocator_meta = { |
| |
pool_page_alloc_meta, pool_page_free_meta |
| |
}; |
| |
|
| /* # of seconds to retain page after last use */ |
/* # of seconds to retain page after last use */ |
| int pool_inactive_time = 10; |
int pool_inactive_time = 10; |
| |
|
| Line 634 pool_init(struct pool *pp, size_t size, |
|
| Line 642 pool_init(struct pool *pp, size_t size, |
|
| * XXX LOCKING. |
* XXX LOCKING. |
| */ |
*/ |
| if (phpool[0].pr_size == 0) { |
if (phpool[0].pr_size == 0) { |
| struct pool_allocator *pa; |
|
| int idx; |
int idx; |
| #ifdef POOL_SUBPAGE |
|
| pa = &pool_allocator_kmem; |
|
| #else |
|
| pa = NULL; |
|
| #endif |
|
| for (idx = 0; idx < PHPOOL_MAX; idx++) { |
for (idx = 0; idx < PHPOOL_MAX; idx++) { |
| static char phpool_names[PHPOOL_MAX][6+1+6+1]; |
static char phpool_names[PHPOOL_MAX][6+1+6+1]; |
| int nelem; |
int nelem; |
| Line 655 pool_init(struct pool *pp, size_t size, |
|
| Line 657 pool_init(struct pool *pp, size_t size, |
|
| + nelem * sizeof(uint16_t); |
+ nelem * sizeof(uint16_t); |
| } |
} |
| pool_init(&phpool[idx], sz, 0, 0, 0, |
pool_init(&phpool[idx], sz, 0, 0, 0, |
| phpool_names[idx], pa); |
phpool_names[idx], &pool_allocator_meta); |
| } |
} |
| #ifdef POOL_SUBPAGE |
#ifdef POOL_SUBPAGE |
| pool_init(&psppool, POOL_SUBPAGE, POOL_SUBPAGE, 0, |
pool_init(&psppool, POOL_SUBPAGE, POOL_SUBPAGE, 0, |
| PR_RECURSIVE, "psppool", &pool_allocator_kmem); |
PR_RECURSIVE, "psppool", &pool_allocator_meta); |
| #endif |
#endif |
| pool_init(&pcgpool, sizeof(struct pool_cache_group), 0, 0, |
pool_init(&pcgpool, sizeof(struct pool_cache_group), 0, 0, |
| 0, "pcgpool", NULL); |
0, "pcgpool", &pool_allocator_meta); |
| } |
} |
| |
|
| /* Insert into the list of all pools. */ |
/* Insert into the list of all pools. */ |
| Line 2240 pool_page_alloc(struct pool *pp, int fla |
|
| Line 2242 pool_page_alloc(struct pool *pp, int fla |
|
| { |
{ |
| boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE; |
boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE; |
| |
|
| return ((void *) uvm_km_alloc_poolpage(waitok)); |
return ((void *) uvm_km_alloc_poolpage_cache(kmem_map, NULL, waitok)); |
| } |
} |
| |
|
| void |
void |
| pool_page_free(struct pool *pp, void *v) |
pool_page_free(struct pool *pp, void *v) |
| { |
{ |
| |
|
| uvm_km_free_poolpage((vaddr_t) v); |
uvm_km_free_poolpage_cache(kmem_map, (vaddr_t) v); |
| |
} |
| |
|
| |
static void * |
| |
pool_page_alloc_meta(struct pool *pp, int flags) |
| |
{ |
| |
boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE; |
| |
|
| |
return ((void *) uvm_km_alloc_poolpage1(kmem_map, NULL, waitok)); |
| |
} |
| |
|
| |
static void |
| |
pool_page_free_meta(struct pool *pp, void *v) |
| |
{ |
| |
|
| |
uvm_km_free_poolpage1(kmem_map, (vaddr_t) v); |
| } |
} |
| |
|
| #ifdef POOL_SUBPAGE |
#ifdef POOL_SUBPAGE |
| Line 2292 pool_page_alloc_nointr(struct pool *pp, |
|
| Line 2309 pool_page_alloc_nointr(struct pool *pp, |
|
| { |
{ |
| boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE; |
boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE; |
| |
|
| return ((void *) uvm_km_alloc_poolpage1(kernel_map, |
return ((void *) uvm_km_alloc_poolpage_cache(kernel_map, |
| uvm.kernel_object, waitok)); |
uvm.kernel_object, waitok)); |
| } |
} |
| |
|
|
|
| pool_page_free_nointr(struct pool *pp, void *v) |
pool_page_free_nointr(struct pool *pp, void *v) |
| { |
{ |
| |
|
| uvm_km_free_poolpage1(kernel_map, (vaddr_t) v); |
uvm_km_free_poolpage_cache(kernel_map, (vaddr_t) v); |
| } |
} |
| #endif /* POOL_SUBPAGE */ |
#endif /* POOL_SUBPAGE */ |