Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/subr_pool.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/subr_pool.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.4.2.2 retrieving revision 1.10 diff -u -p -r1.4.2.2 -r1.10 --- src/sys/kern/subr_pool.c 1998/08/08 03:06:56 1.4.2.2 +++ src/sys/kern/subr_pool.c 1998/08/13 02:10:58 1.10 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.4.2.2 1998/08/08 03:06:56 eeh Exp $ */ +/* $NetBSD: subr_pool.c,v 1.10 1998/08/13 02:10:58 eeh Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -226,6 +226,17 @@ pr_rmpage(pp, ph) { /* + * If the page was idle, decrement the idle page count. + */ + if (ph->ph_nmissing == 0) { +#ifdef DIAGNOSTIC + if (pp->pr_nidle == 0) + panic("pr_rmpage: nidle inconsistent"); +#endif + pp->pr_nidle--; + } + + /* * Unlink a page from the pool and release it. */ TAILQ_REMOVE(&pp->pr_pagelist, ph, ph_pagelist); @@ -373,7 +384,7 @@ pool_init(pp, size, align, ioff, flags, /* The page header will be taken from our page header pool */ pp->pr_phoffset = 0; off = pagesz; - bzero(pp->pr_hashtab, sizeof(pp->pr_hashtab)); + memset(pp->pr_hashtab, 0, sizeof(pp->pr_hashtab)); } /* @@ -400,6 +411,7 @@ pool_init(pp, size, align, ioff, flags, pp->pr_npagealloc = 0; pp->pr_npagefree = 0; pp->pr_hiwat = 0; + pp->pr_nidle = 0; #ifdef POOL_DIAGNOSTIC if ((flags & PR_LOGGING) != 0) { @@ -541,6 +553,13 @@ again: * Remove from item list. */ TAILQ_REMOVE(&ph->ph_itemlist, pi, pi_list); + if (ph->ph_nmissing == 0) { +#ifdef DIAGNOSTIC + if (pp->pr_nidle == 0) + panic("pool_get: nidle inconsistent"); +#endif + pp->pr_nidle--; + } ph->ph_nmissing++; if (TAILQ_FIRST(&ph->ph_itemlist) == NULL) { /* @@ -623,6 +642,7 @@ pool_put(pp, v) * If this page has just become un-empty, move it the head. */ if (ph->ph_nmissing == 0) { + pp->pr_nidle++; if (pp->pr_npages > pp->pr_maxpages) { #if 0 timeout(pool_drain, 0, pool_inactive_time*hz); @@ -730,6 +750,8 @@ pool_prime_page(pp, storage) ph->ph_nmissing = 0; ph->ph_time.tv_sec = ph->ph_time.tv_usec = 0; + pp->pr_nidle++; + /* * Color this page. */ @@ -905,7 +927,8 @@ pool_print(pp, label) printf("%s: ", label); printf("pool %s: nalloc %lu nfree %lu npagealloc %lu npagefree %lu\n" - " npages %u minitems %u itemsperpage %u itemoffset %u\n", + " npages %u minitems %u itemsperpage %u itemoffset %u\n" + " nidle %lu\n", pp->pr_wchan, pp->pr_nget, pp->pr_nput, @@ -914,7 +937,8 @@ pool_print(pp, label) pp->pr_npages, pp->pr_minitems, pp->pr_itemsperpage, - pp->pr_itemoffset); + pp->pr_itemoffset, + pp->pr_nidle); } int