summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-07-19 09:03:04 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-07-19 09:03:04 +0000
commit5dec97ecbcdfeb06e91c08765ca17e236d04ef39 (patch)
tree5f91cd5e9ac39976eb6990ecf1574211fe882388 /sys
parentc8d81ca6add4c250167779f03d3ab5f3b7daeef6 (diff)
After the kernel has reached the sysclt kern.maxclusters limit,
operations get stuck while holding the net lock. Increasing the limit did not help as there was no wakeup of the waiting pools. So introduce pool_wakeup() and run through the mbuf pool request list when the limit changes. OK dlg@ visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_pool.c8
-rw-r--r--sys/kern/uipc_mbuf.c14
-rw-r--r--sys/sys/pool.h3
3 files changed, 20 insertions, 5 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 1db0dcf3be0..6a2b38fca81 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.227 2019/04/23 13:35:12 visa Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.228 2019/07/19 09:03:03 bluhm Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -815,6 +815,12 @@ pool_put(struct pool *pp, void *v)
if (freeph != NULL)
pool_p_free(pp, freeph);
+ pool_wakeup(pp);
+}
+
+void
+pool_wakeup(struct pool *pp)
+{
if (!TAILQ_EMPTY(&pp->pr_requests)) {
pl_enter(pp, &pp->pr_requests_lock);
pool_runqueue(pp, PR_NOWAIT);
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 89011c556a4..ca577c3e102 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.271 2019/07/16 21:41:37 bluhm Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.272 2019/07/19 09:03:03 bluhm Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -167,8 +167,6 @@ mbinit(void)
m_pool_allocator.pa_pagesz = pool_allocator_multi.pa_pagesz;
- error = nmbclust_update(nmbclust);
- KASSERT(error == 0);
mbuf_mem_alloc = 0;
#if DIAGNOSTIC
@@ -196,6 +194,9 @@ mbinit(void)
m_pool_init(&mclpools[i], mclsizes[i], 64, mclnames[i]);
}
+ error = nmbclust_update(nmbclust);
+ KASSERT(error == 0);
+
(void)mextfree_register(m_extfree_pool);
KASSERT(num_extfree_fns == 1);
}
@@ -217,11 +218,18 @@ mbcpuinit()
int
nmbclust_update(long newval)
{
+ int i;
+
if (newval < 0 || newval > LONG_MAX / MCLBYTES)
return ERANGE;
/* update the global mbuf memory limit */
nmbclust = newval;
mbuf_mem_limit = nmbclust * MCLBYTES;
+
+ pool_wakeup(&mbpool);
+ for (i = 0; i < nitems(mclsizes); i++)
+ pool_wakeup(&mclpools[i]);
+
return 0;
}
diff --git a/sys/sys/pool.h b/sys/sys/pool.h
index 079d328a4a0..7f68d50c5ea 100644
--- a/sys/sys/pool.h
+++ b/sys/sys/pool.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pool.h,v 1.76 2019/02/10 22:45:58 tedu Exp $ */
+/* $OpenBSD: pool.h,v 1.77 2019/07/19 09:03:03 bluhm Exp $ */
/* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */
/*-
@@ -271,6 +271,7 @@ void pool_request_init(struct pool_request *,
void (*)(struct pool *, void *, void *), void *);
void pool_request(struct pool *, struct pool_request *);
void pool_put(struct pool *, void *);
+void pool_wakeup(struct pool *);
int pool_reclaim(struct pool *);
void pool_reclaim_all(void);
int pool_prime(struct pool *, int);