summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_pool.c
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2017-07-12 06:39:13 +0000
committervisa <visa@openbsd.org>2017-07-12 06:39:13 +0000
commit63c7b0bd0f6711a74702334062a2395bcd7c92d7 (patch)
tree439d0993434f0b4a19f9d06cba1b3e8ed1040611 /sys/kern/subr_pool.c
parentremove CPU_LIDSUSPEND/machdep.lidsuspend (diff)
downloadwireguard-openbsd-63c7b0bd0f6711a74702334062a2395bcd7c92d7.tar.xz
wireguard-openbsd-63c7b0bd0f6711a74702334062a2395bcd7c92d7.zip
When there is no contention on a pool cache lock, lower the number
of items that a cache list is allowed to hold. This lets the cache release resources back to the common pool after pressure on the cache has decreased. OK dlg@
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r--sys/kern/subr_pool.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 9f1bbae3923..bf0f86d37b5 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.217 2017/06/23 01:21:55 dlg Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.218 2017/07/12 06:39:13 visa Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -1957,6 +1957,9 @@ pool_cache_gc(struct pool *pp)
if ((contention - pp->pr_cache_contention_prev) > 8 /* magic */) {
if ((ncpusfound * 8 * 2) <= pp->pr_cache_nitems)
pp->pr_cache_items += 8;
+ } else if ((contention - pp->pr_cache_contention_prev) == 0) {
+ if (pp->pr_cache_items > 8)
+ pp->pr_cache_items--;
}
pp->pr_cache_contention_prev = contention;
}