From 53d1c25e345aac4dee3a5ac925aa4548eeac7d3c Mon Sep 17 00:00:00 2001 From: yamt Date: Mon, 11 Aug 2008 02:46:40 +0000 Subject: [PATCH] add some KASSERTs. --- sys/kern/subr_pool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 151440a1939f..825698af6bb2 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.167 2008/08/08 16:58:01 skrll Exp $ */ +/* $NetBSD: subr_pool.c,v 1.168 2008/08/11 02:46:40 yamt Exp $ */ /*- * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.167 2008/08/08 16:58:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.168 2008/08/11 02:46:40 yamt Exp $"); #include "opt_ddb.h" #include "opt_pool.h" @@ -1527,6 +1527,8 @@ pool_update_curpage(struct pool *pp) if (pp->pr_curpage == NULL) { pp->pr_curpage = LIST_FIRST(&pp->pr_emptypages); } + KASSERT((pp->pr_curpage == NULL && pp->pr_nitems == 0) || + (pp->pr_curpage != NULL && pp->pr_nitems > 0)); } void @@ -2367,6 +2369,9 @@ pool_cache_get_slow(pool_cache_cpu_t *cc, int s, void **objectp, pool_cache_t pc; void *object; + KASSERT(cc->cc_current->pcg_avail == 0); + KASSERT(cc->cc_previous->pcg_avail == 0); + pc = cc->cc_cache; cc->cc_misses++; @@ -2519,6 +2524,9 @@ pool_cache_put_slow(pool_cache_cpu_t *cc, int s, void *object) uint64_t ncsw; pool_cache_t pc; + KASSERT(cc->cc_current->pcg_avail == cc->cc_current->pcg_size); + KASSERT(cc->cc_previous->pcg_avail == cc->cc_previous->pcg_size); + pc = cc->cc_cache; cc->cc_misses++;