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.50.2.8 retrieving revision 1.84 diff -u -p -r1.50.2.8 -r1.84 --- src/sys/kern/subr_pool.c 2002/06/24 22:10:56 1.50.2.8 +++ src/sys/kern/subr_pool.c 2003/01/18 10:06:33 1.84 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.50.2.8 2002/06/24 22:10:56 nathanw Exp $ */ +/* $NetBSD: subr_pool.c,v 1.84 2003/01/18 10:06:33 thorpej Exp $ */ /*- * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.50.2.8 2002/06/24 22:10:56 nathanw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.84 2003/01/18 10:06:33 thorpej Exp $"); #include "opt_pool.h" #include "opt_poollog.h" @@ -94,7 +94,7 @@ struct pool_item_header { TAILQ_HEAD(,pool_item) ph_itemlist; /* chunk list for this page */ LIST_ENTRY(pool_item_header) ph_hashlist; /* Off-page page headers */ - int ph_nmissing; /* # of chunks in use */ + unsigned int ph_nmissing; /* # of chunks in use */ caddr_t ph_page; /* this page's address */ struct timeval ph_time; /* last referenced */ }; @@ -102,9 +102,9 @@ TAILQ_HEAD(pool_pagelist,pool_item_heade struct pool_item { #ifdef DIAGNOSTIC - int pi_magic; + u_int pi_magic; #endif -#define PI_MAGIC 0xdeadbeef +#define PI_MAGIC 0xdeadbeefU /* Other entries use only this list entry */ TAILQ_ENTRY(pool_item) pi_list; }; @@ -415,7 +415,7 @@ pool_init(struct pool *pp, size_t size, if (size < sizeof(struct pool_item)) size = sizeof(struct pool_item); - size = ALIGN(size); + size = roundup(size, align); #ifdef DIAGNOSTIC if (size > palloc->pa_pagesz) panic("pool_init: pool item size (%lu) too large", @@ -564,7 +564,7 @@ pool_destroy(struct pool *pp) #ifdef DIAGNOSTIC if (pp->pr_nout != 0) { pr_printlog(pp, NULL, printf); - panic("pool_destroy: pool busy: still out: %u\n", + panic("pool_destroy: pool busy: still out: %u", pp->pr_nout); } #endif @@ -636,7 +636,7 @@ pool_get(struct pool *pp, int flags) #ifdef DIAGNOSTIC if (__predict_false(curlwp == NULL && doing_shutdown == 0 && (flags & PR_WAITOK) != 0)) - panic("pool_get: must have NOWAIT"); + panic("pool_get: %s: must have NOWAIT", pp->pr_wchan); #ifdef LOCKDEBUG if (flags & PR_WAITOK) @@ -715,7 +715,7 @@ pool_get(struct pool *pp, int flags) simple_unlock(&pp->pr_slock); printf("pool_get: %s: curpage NULL, nitems %u\n", pp->pr_wchan, pp->pr_nitems); - panic("pool_get: nitems inconsistent\n"); + panic("pool_get: nitems inconsistent"); } #endif @@ -785,7 +785,7 @@ pool_get(struct pool *pp, int flags) simple_unlock(&pp->pr_slock); printf("pool_get: %s: items on itemlist, nitems %u\n", pp->pr_wchan, pp->pr_nitems); - panic("pool_get: nitems inconsistent\n"); + panic("pool_get: nitems inconsistent"); } #endif @@ -916,6 +916,7 @@ pool_do_put(struct pool *pp, void *v) #endif TAILQ_INSERT_HEAD(&ph->ph_itemlist, pi, pi_list); + KDASSERT(ph->ph_nmissing != 0); ph->ph_nmissing--; pp->pr_nput++; pp->pr_nitems++; @@ -1036,7 +1037,7 @@ pool_put(struct pool *pp, void *v) int pool_prime(struct pool *pp, int n) { - struct pool_item_header *ph; + struct pool_item_header *ph = NULL; caddr_t cp; int newpages; @@ -1125,6 +1126,8 @@ pool_prime_page(struct pool *pp, caddr_t while (n--) { pi = (struct pool_item *)cp; + KASSERT(((((vaddr_t)pi) + ioff) & (align - 1)) == 0); + /* Insert on page list */ TAILQ_INSERT_TAIL(&ph->ph_itemlist, pi, pi_list); #ifdef DIAGNOSTIC @@ -1155,7 +1158,7 @@ pool_prime_page(struct pool *pp, caddr_t static int pool_catchup(struct pool *pp) { - struct pool_item_header *ph; + struct pool_item_header *ph = NULL; caddr_t cp; int error = 0; @@ -1422,7 +1425,6 @@ pool_print1(struct pool *pp, const char print_pagelist = 1; if (c == 'c') print_cache = 1; - modif++; } (*pr)("POOL %s: size %u, align %u, ioff %u, roflags 0x%08x\n",