Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Nov 2013 10:17:10 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258338 - head/sys/vm
Message-ID:  <201311191017.rAJAHArf052382@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Nov 19 10:17:10 2013
New Revision: 258338
URL: http://svnweb.freebsd.org/changeset/base/258338

Log:
  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.

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Tue Nov 19 10:10:44 2013	(r258337)
+++ head/sys/vm/uma_core.c	Tue Nov 19 10:17:10 2013	(r258338)
@@ -2529,6 +2529,7 @@ uma_zfree_arg(uma_zone_t zone, void *ite
 {
 	uma_cache_t cache;
 	uma_bucket_t bucket;
+	int lockfail;
 	int cpu;
 
 #ifdef UMA_DEBUG_ALLOC_1
@@ -2613,7 +2614,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];
@@ -2647,7 +2653,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311191017.rAJAHArf052382>