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.69 retrieving revision 1.76.4.1 diff -u -p -r1.69 -r1.76.4.1 --- src/sys/kern/subr_pool.c 2002/03/08 21:43:54 1.69 +++ src/sys/kern/subr_pool.c 2002/07/15 10:36:39 1.76.4.1 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.69 2002/03/08 21:43:54 thorpej Exp $ */ +/* $NetBSD: subr_pool.c,v 1.76.4.1 2002/07/15 10:36:39 gehenna Exp $ */ /*- * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.69 2002/03/08 21:43:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.76.4.1 2002/07/15 10:36:39 gehenna Exp $"); #include "opt_pool.h" #include "opt_poollog.h" @@ -145,16 +145,6 @@ struct pool_item { /* The cache group pool. */ static struct pool pcgpool; -/* The pool cache group. */ -#define PCG_NOBJECTS 16 -struct pool_cache_group { - TAILQ_ENTRY(pool_cache_group) - pcg_list; /* link in the pool cache's group list */ - u_int pcg_avail; /* # available objects */ - /* pointers to the objects */ - void *pcg_objects[PCG_NOBJECTS]; -}; - static void pool_cache_reclaim(struct pool_cache *); static int pool_catchup(struct pool *); @@ -580,9 +570,8 @@ pool_destroy(struct pool *pp) #endif /* Remove all pages */ - if ((pp->pr_roflags & PR_STATIC) == 0) - while ((ph = TAILQ_FIRST(&pp->pr_pagelist)) != NULL) - pr_rmpage(pp, ph, NULL); + while ((ph = TAILQ_FIRST(&pp->pr_pagelist)) != NULL) + pr_rmpage(pp, ph, NULL); /* Remove from global pool list */ simple_lock(&pool_head_slock); @@ -645,15 +634,9 @@ pool_get(struct pool *pp, int flags) void *v; #ifdef DIAGNOSTIC - if (__predict_false((pp->pr_roflags & PR_STATIC) && - (flags & PR_MALLOCOK))) { - pr_printlog(pp, NULL, printf); - panic("pool_get: static"); - } - if (__predict_false(curproc == 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) @@ -966,7 +949,8 @@ pool_do_put(struct pool *pp, void *v) */ if (ph->ph_nmissing == 0) { pp->pr_nidle++; - if (pp->pr_npages > pp->pr_maxpages) { + if (pp->pr_npages > pp->pr_maxpages || + (pp->pr_alloc->pa_flags & PA_WANT) != 0) { pr_rmpage(pp, ph, NULL); } else { TAILQ_REMOVE(&pp->pr_pagelist, ph, ph_pagelist); @@ -1054,7 +1038,7 @@ pool_prime(struct pool *pp, int n) { struct pool_item_header *ph; caddr_t cp; - int newpages, error = 0; + int newpages; simple_lock(&pp->pr_slock); @@ -1068,7 +1052,6 @@ pool_prime(struct pool *pp, int n) simple_lock(&pp->pr_slock); if (__predict_false(cp == NULL || ph == NULL)) { - error = ENOMEM; if (cp != NULL) pool_allocator_free(pp, cp); break; @@ -1166,9 +1149,7 @@ pool_prime_page(struct pool *pp, caddr_t * * Note 1, we never wait for memory here, we let the caller decide what to do. * - * Note 2, this doesn't work with static pools. - * - * Note 3, we must be called with the pool already locked, and we return + * Note 2, we must be called with the pool already locked, and we return * with it locked. */ static int @@ -1178,18 +1159,6 @@ pool_catchup(struct pool *pp) caddr_t cp; int error = 0; - if (pp->pr_roflags & PR_STATIC) { - /* - * We dropped below the low water mark, and this is not a - * good thing. Log a warning. - * - * XXX: rate-limit this? - */ - printf("WARNING: static pool `%s' dropped below low water " - "mark\n", pp->pr_wchan); - return (0); - } - while (POOL_NEEDS_CATCHUP(pp)) { /* * Call the page back-end allocator for more memory. @@ -1218,7 +1187,6 @@ pool_catchup(struct pool *pp) void pool_setlowat(struct pool *pp, int n) { - int error; simple_lock(&pp->pr_slock); @@ -1228,7 +1196,7 @@ pool_setlowat(struct pool *pp, int n) : roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; /* Make sure we're caught up with the newly-set low water mark. */ - if (POOL_NEEDS_CATCHUP(pp) && (error = pool_catchup(pp) != 0)) { + if (POOL_NEEDS_CATCHUP(pp) && pool_catchup(pp) != 0) { /* * XXX: Should we log a warning? Should we set up a timeout * to try again in a second or so? The latter could break @@ -1291,9 +1259,6 @@ pool_reclaim(struct pool *pp) struct pool_pagelist pq; int s; - if (pp->pr_roflags & PR_STATIC) - return (0); - if (pp->pr_drain_hook != NULL) { /* * The drain hook must be called with the pool unlocked. @@ -1977,9 +1942,9 @@ pool_allocator_alloc(struct pool *org, i TAILQ_INSERT_TAIL(&pa->pa_list, pp, pr_alloc_list); if (pp == org) continue; - simple_unlock(&pa->pa_list); + simple_unlock(&pa->pa_slock); freed = pool_reclaim(pp); - simple_lock(&pa->pa_list); + simple_lock(&pa->pa_slock); } while ((pp = TAILQ_FIRST(&pa->pa_list)) != start && freed == 0);