summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-01-04 23:38:06 +0000
committermav <mav@FreeBSD.org>2014-01-04 23:38:06 +0000
commit4f2347ab59fa48afa63ac0bd851c70da5358425a (patch)
tree87367bae283335bff084c7fd8a33a657e9749f7b
parent363e273d8f7f8248532f1ed348a72ee0dea621c4 (diff)
downloadFreeBSD-src-4f2347ab59fa48afa63ac0bd851c70da5358425a.zip
FreeBSD-src-4f2347ab59fa48afa63ac0bd851c70da5358425a.tar.gz
MFC r258338:
Grow UMA zone bucket size also on lock congestion during item free. Lock congestion is the same, whether it happens on alloc or free, so handle it equally. Now that we have back pressure, there is no problem to grow buckets a bit faster. Any way growth is much slower then in 9.x.
-rw-r--r--sys/vm/uma_core.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 3162e60..2e0610c 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -2531,6 +2531,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata)
{
uma_cache_t cache;
uma_bucket_t bucket;
+ int lockfail;
int cpu;
#ifdef UMA_DEBUG_ALLOC_1
@@ -2615,7 +2616,12 @@ zfree_start:
if (zone->uz_count == 0 || bucketdisable)
goto zfree_item;
- ZONE_LOCK(zone);
+ lockfail = 0;
+ if (ZONE_TRYLOCK(zone) == 0) {
+ /* Record contention to size the buckets. */
+ ZONE_LOCK(zone);
+ lockfail = 1;
+ }
critical_enter();
cpu = curcpu;
cache = &zone->uz_cpu[cpu];
@@ -2649,7 +2655,12 @@ zfree_start:
/* We are no longer associated with this CPU. */
critical_exit();
- /* And the zone.. */
+ /*
+ * We bump the uz count when the cache size is insufficient to
+ * handle the working set.
+ */
+ if (lockfail && zone->uz_count < BUCKET_MAX)
+ zone->uz_count++;
ZONE_UNLOCK(zone);
#ifdef UMA_DEBUG_ALLOC
OpenPOWER on IntegriCloud