summaryrefslogtreecommitdiff
path: root/sys/kern/subr_pool.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-10-14 20:09:42 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-10-14 20:09:42 +0000
commit8968677b0a8e49f7b5bd4250a387dc45b227f25b (patch)
tree070dfbe5a0d197b55bbe62df9830839f5a38f40a /sys/kern/subr_pool.c
parent062cdec80858b7c0cc2b211bec2e16eefa14ecdb (diff)
- Do not try to drain other pools if PR_NOWAIT and the allocator can't
give us pages. PR_NOWAIT most likely means "hey, we're coming from an interrupt, don't mess with stuff that doesn't have proper protection". - pool_allocator_free is called in too many places so I don't feel comfortable without that added protection from splvm (and besides, pool_allocator_free is rarely called anyway, so the extra spl will be unnoticeable). It shouldn't matter when fiddling with those flags, but you never know. - Remove a wakeup without a matching tsleep. It's a left-over from some other code path that I've been investigating when reworking the pool a while ago and it should have been removed before that commit. deraadt@ ok
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r--sys/kern/subr_pool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 74e22626cc8..b5eeb23c2ee 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.34 2002/10/13 18:26:12 krw Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.35 2002/10/14 20:09:41 art Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -1947,6 +1947,7 @@ pool_allocator_alloc(struct pool *org, int flags)
if ((res = (*pa->pa_alloc)(org, flags)) != NULL)
return (res);
}
+ break;
}
s = splvm();
simple_lock(&pa->pa_slock);
@@ -1961,12 +1962,15 @@ void
pool_allocator_free(struct pool *pp, void *v)
{
struct pool_allocator *pa = pp->pr_alloc;
+ int s;
(*pa->pa_free)(pp, v);
+ s = splvm();
simple_lock(&pa->pa_slock);
if ((pa->pa_flags & PA_WANT) == 0) {
simple_unlock(&pa->pa_slock);
+ splx(s);
return;
}
@@ -1978,9 +1982,9 @@ pool_allocator_free(struct pool *pp, void *v)
}
simple_unlock(&pp->pr_slock);
}
- wakeup(pa);
pa->pa_flags &= ~PA_WANT;
simple_unlock(&pa->pa_slock);
+ splx(s);
}
/*