From owner-freebsd-arch@FreeBSD.ORG Thu Jan 24 18:40:22 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E769C385; Thu, 24 Jan 2013 18:40:22 +0000 (UTC) (envelope-from jasone@freebsd.org) Received: from canonware.com (canonware.com [204.109.63.53]) by mx1.freebsd.org (Postfix) with ESMTP id CCA89D93; Thu, 24 Jan 2013 18:40:22 +0000 (UTC) Received: from jemac.thefacebook.com (unknown [173.252.71.4]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id 78D0428417; Thu, 24 Jan 2013 10:40:16 -0800 (PST) Subject: Re: [rfc] enabling MALLOC_PRODUCTION on -HEAD for now, until jemalloc has been taught to have some run time selectable debug options Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: Jason Evans In-Reply-To: Date: Thu, 24 Jan 2013 10:40:15 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Adrian Chadd X-Mailer: Apple Mail (2.1283) Cc: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 18:40:23 -0000 On Jan 19, 2013, at 10:26 PM, Adrian Chadd wrote: > I'd like to enable MALLOC_PRODUCTION on -HEAD. >=20 > I'm currently recompiling my libc on this g4 powerbook because the > -HEAD snapshots don't have it enabled by default; just to get some > damned decent performance out of this thing. >=20 > I'll work with Jason and others (eg Ian) who have a vested interest in > trying to get it to run better out of the box, but still have the > debug options available for people who wish to debug things. I imported jemalloc 3.3.0 last night, which I think will restore = non-MALLOC_PRODUCTION performance to roughly what it has been for years. = The key change was a patch by Ian Lepore: = http://www.canonware.com/cgi-bin/gitweb.cgi?p=3Djemalloc.git;a=3Dcommitdif= f;h=3D14a2c6a698a207ac3f3825443cf3441c8842e990 In practice, the zeroed memory validation should no longer execute at = all on FreeBSD due to madvise(...MADV_FREE) not guaranteeing zeroed = memory. I don't know how significant the impact will be on constrained/older = systems, but for the many buildworld repetitions I did during testing it = improved throughput by >1.5X. With this change in place, I'm not keen = on enabling MALLOC_PRODUCTION by default, because the assertions are = useful both for detecting bugs in jemalloc (heaven forbid), and for = indicating that crashes within jemalloc are application errors. The = only other significant source of overhead I'm aware of is junk filling, = which we've had enabled by default on -current for ages, probably since = the introduction of phkmalloc. If you don't like it: ln -s 'junk:false' /etc/malloc.conf If a substantial performance difference remains for you = (MALLOC_PRODUCTION vs non-MALLOC_PRODUCTION with junk:false set), please = let me know. Thanks, Jason=