Index: subr_pool.c =================================================================== RCS file: /cvs/src/sys/kern/subr_pool.c,v retrieving revision 1.159 diff -u -p -r1.159 subr_pool.c --- subr_pool.c 23 Sep 2014 19:54:47 -0000 1.159 +++ subr_pool.c 26 Sep 2014 05:27:24 -0000 @@ -341,6 +341,8 @@ pool_init(struct pool *pp, size_t size, SIMPLEQ_INSERT_HEAD(&pool_head, pp, pr_poollist); pool_count++; rw_exit_write(&pool_lock); + + printf("%s(%s, %u)\n", __func__, wchan, (u_int)size); } void @@ -425,7 +427,6 @@ pool_get(struct pool *pp, int flags) KASSERT(flags & (PR_WAITOK | PR_NOWAIT)); - mtx_enter(&pp->pr_mtx); if (pp->pr_nout >= pp->pr_hardlimit) { if (ISSET(flags, PR_NOWAIT|PR_LIMITFAIL)) @@ -455,11 +456,13 @@ pool_get(struct pool *pp, int flags) if (ISSET(flags, PR_ZERO)) memset(v, 0, pp->pr_size); + printf("%s(%s, %x) %p\n", __func__, pp->pr_wchan, flags, v); return (v); fail: pp->pr_nfail++; mtx_leave(&pp->pr_mtx); + printf("%s(%s, %x) %p\n", __func__, pp->pr_wchan, flags, NULL); return (NULL); } @@ -624,6 +627,8 @@ pool_put(struct pool *pp, void *v) panic("%s: NULL item", __func__); #endif + printf("%s(%s, %p)\n", __func__, pp->pr_wchan, v); + mtx_enter(&pp->pr_mtx); ph = pr_find_pagehead(pp, v); @@ -694,6 +699,8 @@ pool_prime(struct pool *pp, int n) struct pool_item_header *ph; int newpages; + printf("%s(%s, %d)\n", __func__, pp->pr_wchan, n); + newpages = roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; while (newpages-- > 0) { @@ -847,7 +854,9 @@ pool_update_curpage(struct pool *pp) void pool_setlowat(struct pool *pp, int n) { - int prime; + int prime = 0; + + printf("%s(%s, %d)\n", __func__, pp->pr_wchan, n); mtx_enter(&pp->pr_mtx); pp->pr_minitems = n; @@ -855,7 +864,8 @@ pool_setlowat(struct pool *pp, int n) ? 0 : roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; - prime = pp->pr_nitems - n; + if (pp->pr_nitems < n) + prime = n - pp->pr_nitems; mtx_leave(&pp->pr_mtx); if (prime > 0) @@ -865,6 +875,8 @@ pool_setlowat(struct pool *pp, int n) void pool_sethiwat(struct pool *pp, int n) { + printf("%s(%s, %d)\n", __func__, pp->pr_wchan, n); + pp->pr_maxpages = (n == 0) ? 0 : roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; @@ -875,6 +887,8 @@ pool_sethardlimit(struct pool *pp, u_int { int error = 0; + printf("%s(%s, %d)\n", __func__, pp->pr_wchan, n); + if (n < pp->pr_nout) { error = EINVAL; goto done; @@ -907,6 +921,8 @@ pool_reclaim(struct pool *pp) struct pool_item_header *ph, *phnext; struct pool_pagelist pl = LIST_HEAD_INITIALIZER(pl); + printf("%s(%s)\n", __func__, pp->pr_wchan); + mtx_enter(&pp->pr_mtx); for (ph = LIST_FIRST(&pp->pr_emptypages); ph != NULL; ph = phnext) { phnext = LIST_NEXT(ph, ph_pagelist); @@ -1335,6 +1351,8 @@ pool_allocator_alloc(struct pool *pp, in v = (*pp->pr_alloc->pa_alloc)(pp, flags, slowdown); KERNEL_UNLOCK(); + printf("%s(%s, %x) %p\n", __func__, pp->pr_wchan, flags, v); + #ifdef DIAGNOSTIC if (v != NULL && POOL_INPGHDR(pp)) { vaddr_t addr = (vaddr_t)v; @@ -1352,6 +1370,8 @@ void pool_allocator_free(struct pool *pp, void *v) { struct pool_allocator *pa = pp->pr_alloc; + + printf("%s(%s, %p)\n", __func__, pp->pr_wchan, v); KERNEL_LOCK(); (*pa->pa_free)(pp, v);