From owner-svn-src-head@FreeBSD.ORG Mon Feb 10 19:48:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C503FE7F; Mon, 10 Feb 2014 19:48:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B0C0B11A0; Mon, 10 Feb 2014 19:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1AJmQFb083934; Mon, 10 Feb 2014 19:48:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1AJmQZb083933; Mon, 10 Feb 2014 19:48:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201402101948.s1AJmQZb083933@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 10 Feb 2014 19:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261723 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Feb 2014 19:48:26 -0000 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) {