Index: sys/pool.h =================================================================== RCS file: /cvs/src/sys/sys/pool.h,v retrieving revision 1.72 diff -u -p -r1.72 pool.h --- sys/pool.h 19 Jun 2017 23:57:12 -0000 1.72 +++ sys/pool.h 20 Jun 2017 23:53:44 -0000 @@ -186,7 +186,7 @@ struct pool { struct mutex pr_cache_mtx; struct pool_cache_lists pr_cache_lists; /* list of idle item lists */ - u_int pr_cache_nlist; /* # of idle lists */ + u_int pr_cache_nitems; /* # of idle items */ u_int pr_cache_items; /* target list length */ u_int pr_cache_contention; u_int pr_cache_contention_prev; Index: kern/subr_pool.c =================================================================== RCS file: /cvs/src/sys/kern/subr_pool.c,v retrieving revision 1.215 diff -u -p -r1.215 subr_pool.c --- kern/subr_pool.c 19 Jun 2017 23:57:12 -0000 1.215 +++ kern/subr_pool.c 20 Jun 2017 23:53:44 -0000 @@ -1635,8 +1635,8 @@ pool_cache_init(struct pool *pp) struct cpumem_iter i; if (pool_caches.pr_size == 0) { - pool_init(&pool_caches, sizeof(struct pool_cache), 64, - IPL_NONE, PR_WAITOK, "plcache", NULL); + pool_init(&pool_caches, sizeof(struct pool_cache), + CACHELINESIZE, IPL_NONE, PR_WAITOK, "plcache", NULL); } /* must be able to use the pool items as cache list items */ @@ -1647,7 +1647,7 @@ pool_cache_init(struct pool *pp) mtx_init(&pp->pr_cache_mtx, pp->pr_ipl); arc4random_buf(pp->pr_cache_magic, sizeof(pp->pr_cache_magic)); TAILQ_INIT(&pp->pr_cache_lists); - pp->pr_cache_nlist = 0; + pp->pr_cache_nitems = 0; pp->pr_cache_tick = ticks; pp->pr_cache_items = 8; pp->pr_cache_contention = 0; @@ -1729,7 +1729,7 @@ pool_cache_list_alloc(struct pool *pp, s pl = TAILQ_FIRST(&pp->pr_cache_lists); if (pl != NULL) { TAILQ_REMOVE(&pp->pr_cache_lists, pl, ci_nextl); - pp->pr_cache_nlist--; + pp->pr_cache_nitems -= POOL_CACHE_ITEM_NITEMS(pl); pool_cache_item_magic(pp, pl); @@ -1753,8 +1753,8 @@ pool_cache_list_free(struct pool *pp, st if (TAILQ_EMPTY(&pp->pr_cache_lists)) pp->pr_cache_tick = ticks; + pp->pr_cache_nitems += POOL_CACHE_ITEM_NITEMS(ci); TAILQ_INSERT_TAIL(&pp->pr_cache_lists, ci, ci_nextl); - pp->pr_cache_nlist++; pc->pc_nlput++; @@ -1936,8 +1936,8 @@ pool_cache_gc(struct pool *pp) pl = TAILQ_FIRST(&pp->pr_cache_lists); if (pl != NULL) { TAILQ_REMOVE(&pp->pr_cache_lists, pl, ci_nextl); + pp->pr_cache_nitems -= POOL_CACHE_ITEM_NITEMS(pl); pp->pr_cache_tick = ticks; - pp->pr_cache_nlist--; pp->pr_cache_ngc++; } @@ -1955,14 +1955,8 @@ pool_cache_gc(struct pool *pp) contention = pp->pr_cache_contention; if ((contention - pp->pr_cache_contention_prev) > 8 /* magic */) { - unsigned int limit = pp->pr_npages * pp->pr_itemsperpage; - unsigned int items = pp->pr_cache_items + 8; - unsigned int cache = ncpusfound * items * 2; - - /* are there enough items around so every cpu can hold some? */ - - if (cache < limit) - pp->pr_cache_items = items; + if ((ncpusfound * 8 * 2) <= pp->pr_cache_nitems) + pp->pr_cache_items += 8; } pp->pr_cache_contention_prev = contention; } @@ -2016,7 +2010,7 @@ pool_cache_info(struct pool *pp, void *o mtx_enter(&pp->pr_cache_mtx); kpc.pr_ngc = pp->pr_cache_ngc; kpc.pr_len = pp->pr_cache_items; - kpc.pr_nlist = pp->pr_cache_nlist; + kpc.pr_nlist = pp->pr_cache_nitems; kpc.pr_contention = pp->pr_cache_contention; mtx_leave(&pp->pr_cache_mtx);