* systems.
*/
isc_mempool_setfreemax(commctx, 6);
- isc_mempool_setfillcount(commctx, 2);
isc_mutex_init(&lookup_lock);
}
isc_mutex_init(&inst->hlock);
/*
- * Fill the mempool with 1K filter_aaaa state objects at
- * a time; ideally after a single allocation, the mempool will
- * have enough to handle all the simultaneous queries the system
- * requires and it won't be necessary to allocate more.
- *
* We don't set any limit on the number of free state objects
* so that they'll always be returned to the pool and not
* freed until the pool is destroyed on shutdown.
*/
- isc_mempool_setfillcount(inst->datapool, 1024);
isc_mempool_setfreemax(inst->datapool, UINT_MAX);
isc_mutex_init(&inst->plock);
isc_mempool_associatelock(inst->datapool, &inst->plock);
do { \
isc_mempool_create(mem, sizeof(t), &(p)); \
isc_mempool_setfreemax((p), FREE_ITEMS); \
- isc_mempool_setfillcount((p), FILL_COUNT); \
isc_mempool_setname((p), n); \
isc_mempool_associatelock((p), &adb->mplock); \
} while (0)
isc_mempool_setname(mgr->depool, "dispmgr_depool");
isc_mempool_setfreemax(mgr->depool, 32768);
isc_mempool_associatelock(mgr->depool, &mgr->depool_lock);
- isc_mempool_setfillcount(mgr->depool, 32);
isc_mempool_setname(mgr->rpool, "dispmgr_rpool");
isc_mempool_setfreemax(mgr->rpool, 32768);
isc_mempool_associatelock(mgr->rpool, &mgr->rpool_lock);
- isc_mempool_setfillcount(mgr->rpool, 32);
isc_mempool_setname(mgr->dpool, "dispmgr_dpool");
isc_mempool_setfreemax(mgr->dpool, 32768);
isc_mempool_associatelock(mgr->dpool, &mgr->dpool_lock);
- isc_mempool_setfillcount(mgr->dpool, 32);
mgr->buffers = 0;
mgr->buffersize = 0;
isc_mempool_setname(mgr->bpool, "dispmgr_bpool");
isc_mempool_setfreemax(mgr->bpool, maxbuffers);
isc_mempool_associatelock(mgr->bpool, &mgr->bpool_lock);
- isc_mempool_setfillcount(mgr->bpool, 32);
}
/* Create or adjust socket pool */
isc_mempool_setname(mgr->spool, "dispmgr_spool");
isc_mempool_setfreemax(mgr->spool, maxrequests);
isc_mempool_associatelock(mgr->spool, &mgr->spool_lock);
- isc_mempool_setfillcount(mgr->spool, 32);
result = qid_allocate(mgr, buckets, increment, &mgr->qid, true);
if (result != ISC_R_SUCCESS) {
isc_mempool_setname(disp->sepool, "disp_sepool");
isc_mempool_setfreemax(disp->sepool, 32768);
isc_mempool_associatelock(disp->sepool, &disp->sepool_lock);
- isc_mempool_setfillcount(disp->sepool, 16);
attributes &= ~DNS_DISPATCHATTR_TCP;
attributes |= DNS_DISPATCHATTR_UDP;
ISC_LIST_INIT(m->freerdatalist);
isc_mempool_create(m->mctx, sizeof(dns_name_t), &m->namepool);
- isc_mempool_setfillcount(m->namepool, NAME_COUNT);
isc_mempool_setfreemax(m->namepool, NAME_COUNT);
isc_mempool_setname(m->namepool, "msg:names");
isc_mempool_create(m->mctx, sizeof(dns_rdataset_t), &m->rdspool);
- isc_mempool_setfillcount(m->rdspool, RDATASET_COUNT);
isc_mempool_setfreemax(m->rdspool, RDATASET_COUNT);
isc_mempool_setname(m->rdspool, "msg:rdataset");
*
* Defaults:
*\li freemax = 1
- *\li fillcount = 1
*
* Returns:
*\li #ISC_R_NOMEMORY -- not enough memory to create pool
* Returns the number of items allocated from this pool.
*/
-unsigned int
-isc_mempool_getfillcount(isc_mempool_t *mpctx);
-/*%<
- * Returns the number of items allocated as a block from the parent
- * memory context when the free list is empty.
- */
-
-void
-isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit);
-/*%<
- * Sets the fillcount.
- *
- * Additional requirements:
- *\li limit > 0
- */
-
/*
* Pseudo-private functions for use via macros. Do not call directly.
*/
atomic_size_t allocated; /*%< # of items currently given out */
atomic_size_t freecount; /*%< # of items on reserved list */
atomic_size_t freemax; /*%< # of items allowed on free list */
- atomic_size_t fillcount; /*%< # of items to fetch on each fill */
/*%< Stats only. */
atomic_size_t gets; /*%< # of requests to this pool */
/*%< Debugging only. */
pool = ISC_LIST_HEAD(ctx->pools);
if (pool != NULL) {
fprintf(out, "[Pool statistics]\n");
- fprintf(out, "%15s %10s %10s %10s %10s %10s %10s %1s\n", "name",
+ fprintf(out, "%15s %10s %10s %10s %10s %10s %1s\n", "name",
"size", "allocated", "freecount", "freemax",
- "fillcount", "gets", "L");
+ "gets", "L");
}
while (pool != NULL) {
- fprintf(out, "%15s %10zu %10zu %10zu %10zu %10zu %10zu %s\n",
+ fprintf(out, "%15s %10zu %10zu %10zu %10zu %10zu %s\n",
pool->name, pool->size,
atomic_load_relaxed(&pool->allocated),
atomic_load_relaxed(&pool->freecount),
atomic_load_relaxed(&pool->freemax),
- atomic_load_relaxed(&pool->fillcount),
atomic_load_relaxed(&pool->gets),
(pool->lock == NULL ? "N" : "Y"));
pool = ISC_LIST_NEXT(pool, link);
atomic_init(&mpctx->allocated, 0);
atomic_init(&mpctx->freecount, 0);
atomic_init(&mpctx->freemax, 1);
- atomic_init(&mpctx->fillcount, 1);
*mpctxp = (isc_mempool_t *)mpctx;
MPCTXLOCK(mpctx);
if (ISC_UNLIKELY(mpctx->items == NULL)) {
isc_mem_t *mctx = mpctx->mctx;
- size_t fillcount = atomic_load_acquire(&mpctx->fillcount);
- /*
- * We need to dip into the well. Lock the memory
- * context here and fill up our free list.
- */
- for (i = 0; i < fillcount; i++) {
- item = mem_get(mctx, mpctx->size);
- mem_getstats(mctx, mpctx->size);
- item->next = mpctx->items;
- mpctx->items = item;
- atomic_fetch_add_relaxed(&mpctx->freecount, 1);
- }
- }
-
- /*
- * If we didn't get any items, return NULL.
- */
- item = mpctx->items;
- if (ISC_UNLIKELY(item == NULL)) {
- goto out;
+ item = mem_get(mctx, mpctx->size);
+ mem_getstats(mctx, mpctx->size);
+ item->next = NULL;
+ } else {
+ item = mpctx->items;
}
+ REQUIRE(item != NULL);
mpctx->items = item->next;
return (atomic_load_relaxed(&mpctx->allocated));
}
-void
-isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit) {
- REQUIRE(VALID_MEMPOOL(mpctx));
- REQUIRE(limit > 0);
-
- atomic_store_release(&mpctx->fillcount, limit);
-}
-
-unsigned int
-isc_mempool_getfillcount(isc_mempool_t *mpctx) {
- REQUIRE(VALID_MEMPOOL(mpctx));
-
- return (atomic_load_relaxed(&mpctx->fillcount));
-}
-
/*
* Requires contextslock to be held by caller.
*/
isc_mempool_setname(mgr->reqpool, "nm_reqpool");
isc_mempool_setfreemax(mgr->reqpool, 4096);
isc_mempool_associatelock(mgr->reqpool, &mgr->reqlock);
- isc_mempool_setfillcount(mgr->reqpool, 32);
isc_mutex_init(&mgr->evlock);
isc_mempool_create(mgr->mctx, sizeof(isc__netievent_storage_t),
isc_mempool_setname(mgr->evpool, "nm_evpool");
isc_mempool_setfreemax(mgr->evpool, 4096);
isc_mempool_associatelock(mgr->evpool, &mgr->evlock);
- isc_mempool_setfillcount(mgr->evpool, 32);
mgr->workers = isc_mem_get(mctx, workers * sizeof(isc__networker_t));
for (size_t i = 0; i < workers; i++) {
}
#define MP1_FREEMAX 10
-#define MP1_FILLCNT 10
#define MP1_MAXALLOC 30
#define MP2_FREEMAX 25
-#define MP2_FILLCNT 25
/* general memory system tests */
static void
isc_mempool_create(test_mctx, 31, &mp2);
isc_mempool_setfreemax(mp1, MP1_FREEMAX);
- isc_mempool_setfillcount(mp1, MP1_FILLCNT);
/*
* Allocate MP1_MAXALLOC items from the pool. This is our max.
*/
isc_mempool_setfreemax(mp2, 25);
- isc_mempool_setfillcount(mp2, 25);
for (j = 0; j < 500000; j++) {
for (i = 0; i < 50; i++) {
isc_mempool_associatelock(mp, &mplock);
isc_mempool_setfreemax(mp, 32768);
- isc_mempool_setfillcount(mp, ISC_MAX(NUM_ITEMS / nthreads, 1));
UNUSED(state);
isc_mempool_create
isc_mempool_destroy
isc_mempool_getallocated
-isc_mempool_getfillcount
isc_mempool_getfreecount
isc_mempool_getfreemax
-isc_mempool_setfillcount
isc_mempool_setfreemax
isc_mempool_setname
isc_mutexblock_destroy