Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2014 19:48:26 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261723 - head/sys/vm
Message-ID:  <201402101948.s1AJmQZb083933@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Feb 10 19:48:26 2014
New Revision: 261723
URL: http://svnweb.freebsd.org/changeset/base/261723

Log:
  Make M_ZERO flag work correctly on UMA_ZONE_PCPU zones.
  
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Mon Feb 10 19:47:14 2014	(r261722)
+++ head/sys/vm/uma_core.c	Mon Feb 10 19:48:26 2014	(r261723)
@@ -267,6 +267,7 @@ static uma_keg_t uma_kcreate(uma_zone_t 
     uma_fini fini, int align, uint32_t flags);
 static int zone_import(uma_zone_t zone, void **bucket, int max, int flags);
 static void zone_release(uma_zone_t zone, void **bucket, int cnt);
+static void uma_zero_item(void *item, uma_zone_t zone);
 
 void uma_print_zone(uma_zone_t);
 void uma_print_stats(void);
@@ -2170,7 +2171,7 @@ zalloc_start:
 		uma_dbg_alloc(zone, NULL, item);
 #endif
 		if (flags & M_ZERO)
-			bzero(item, zone->uz_size);
+			uma_zero_item(item, zone);
 		return (item);
 	}
 
@@ -2620,7 +2621,7 @@ zone_alloc_item(uma_zone_t zone, void *u
 	uma_dbg_alloc(zone, NULL, item);
 #endif
 	if (flags & M_ZERO)
-		bzero(item, zone->uz_size);
+		uma_zero_item(item, zone);
 
 	return (item);
 
@@ -3237,6 +3238,17 @@ uma_large_free(uma_slab_t slab)
 	zone_free_item(slabzone, slab, NULL, SKIP_NONE);
 }
 
+static void
+uma_zero_item(void *item, uma_zone_t zone)
+{
+
+	if (zone->uz_flags & UMA_ZONE_PCPU) {
+		for (int i = 0; i < mp_ncpus; i++)
+			bzero(zpcpu_get_cpu(item, i), zone->uz_size);
+	} else
+		bzero(item, zone->uz_size);
+}
+
 void
 uma_print_stats(void)
 {



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