diff options
author | 2017-07-12 08:51:42 +0000 | |
---|---|---|
committer | 2017-07-12 08:51:42 +0000 | |
commit | ecdf287e24dd2570a1ca1978c19c39c665728462 (patch) | |
tree | 2c56ffa4479dd5a3aaf4537831d2cbeb1f4d7d5f /sys/kern/subr_pool.c | |
parent | When there is no contention on a pool cache lock, lower the number (diff) | |
download | wireguard-openbsd-ecdf287e24dd2570a1ca1978c19c39c665728462.tar.xz wireguard-openbsd-ecdf287e24dd2570a1ca1978c19c39c665728462.zip |
Compute the level of contention only once.
Suggested by and OK dlg@
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r-- | sys/kern/subr_pool.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index bf0f86d37b5..6a18ed21d3a 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.218 2017/07/12 06:39:13 visa Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.219 2017/07/12 08:51:42 visa Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -1926,7 +1926,7 @@ pool_cache_destroy(struct pool *pp) void pool_cache_gc(struct pool *pp) { - unsigned int contention; + unsigned int contention, delta; if ((ticks - pp->pr_cache_tick) > (hz * pool_wait_gc) && !TAILQ_EMPTY(&pp->pr_cache_lists) && @@ -1954,10 +1954,11 @@ pool_cache_gc(struct pool *pp) */ contention = pp->pr_cache_contention; - if ((contention - pp->pr_cache_contention_prev) > 8 /* magic */) { + delta = contention - pp->pr_cache_contention_prev; + if (delta > 8 /* magic */) { if ((ncpusfound * 8 * 2) <= pp->pr_cache_nitems) pp->pr_cache_items += 8; - } else if ((contention - pp->pr_cache_contention_prev) == 0) { + } else if (delta == 0) { if (pp->pr_cache_items > 8) pp->pr_cache_items--; } |