diff options
-rw-r--r-- | sys/kern/subr_pool.c | 18 | ||||
-rw-r--r-- | sys/sys/pool.h | 7 |
2 files changed, 12 insertions, 13 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 546589f69ce..536ea29701c 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.199 2016/11/02 01:20:50 dlg Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.200 2016/11/02 01:58:07 dlg Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -100,9 +100,8 @@ struct pool_item { #ifdef MULTIPROCESSOR struct pool_list { struct pool_list *pl_next; /* next in list */ - unsigned long pl_cookie; - struct pool_list *pl_nextl; /* next list */ unsigned long pl_nitems; /* items in list */ + TAILQ_ENTRY(pool_list) pl_nextl; /* list of lists */ }; struct pool_cache { @@ -1574,7 +1573,7 @@ pool_cache_init(struct pool *pp) cm = cpumem_get(&pool_caches); mtx_init(&pp->pr_cache_mtx, pp->pr_ipl); - pp->pr_cache_list = NULL; + TAILQ_INIT(&pp->pr_cache_lists); pp->pr_cache_nlist = 0; pp->pr_cache_items = 8; pp->pr_cache_contention = 0; @@ -1614,9 +1613,9 @@ pool_list_alloc(struct pool *pp, struct pool_cache *pc) struct pool_list *pl; pool_list_enter(pp); - pl = pp->pr_cache_list; + pl = TAILQ_FIRST(&pp->pr_cache_lists); if (pl != NULL) { - pp->pr_cache_list = pl->pl_nextl; + TAILQ_REMOVE(&pp->pr_cache_lists, pl, pl_nextl); pp->pr_cache_nlist--; } @@ -1631,8 +1630,7 @@ static inline void pool_list_free(struct pool *pp, struct pool_cache *pc, struct pool_list *pl) { pool_list_enter(pp); - pl->pl_nextl = pp->pr_cache_list; - pp->pr_cache_list = pl; + TAILQ_INSERT_TAIL(&pp->pr_cache_lists, pl, pl_nextl); pp->pr_cache_nlist++; pp->pr_cache_nout += pc->pc_nout; @@ -1732,7 +1730,7 @@ pool_list_put(struct pool *pp, struct pool_list *pl) if (pl == NULL) return (NULL); - rpl = (struct pool_list *)pl->pl_next; + rpl = TAILQ_NEXT(pl, pl_nextl); do { npl = pl->pl_next; @@ -1761,7 +1759,7 @@ pool_cache_destroy(struct pool *pp) cpumem_put(&pool_caches, cm); - pl = pp->pr_cache_list; + pl = TAILQ_FIRST(&pp->pr_cache_lists); while (pl != NULL) pl = pool_list_put(pp, pl); } diff --git a/sys/sys/pool.h b/sys/sys/pool.h index 26639ee76d5..a4806e38c94 100644 --- a/sys/sys/pool.h +++ b/sys/sys/pool.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pool.h,v 1.64 2016/11/02 01:20:50 dlg Exp $ */ +/* $OpenBSD: pool.h,v 1.65 2016/11/02 01:58:07 dlg Exp $ */ /* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */ /*- @@ -85,6 +85,7 @@ struct pool_allocator { TAILQ_HEAD(pool_pagelist, pool_item_header); struct pool_list; +TAILQ_HEAD(pool_lists, pool_list); struct cpumem; struct pool { @@ -129,8 +130,8 @@ struct pool { struct cpumem * pr_cache; struct mutex pr_cache_mtx; - struct pool_list * - pr_cache_list; + struct pool_lists + pr_cache_lists; u_int pr_cache_nlist; u_int pr_cache_items; u_int pr_cache_contention; |