From owner-freebsd-arch@FreeBSD.ORG Sat Dec 22 22:40:43 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D15EB3B3; Sat, 22 Dec 2012 22:40:43 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id A61DB8FC0C; Sat, 22 Dec 2012 22:40:43 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id qBMMeelV049987; Sat, 22 Dec 2012 22:40:40 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 8pqwut2y98yyjain7bupjg43nw; Sat, 22 Dec 2012 22:40:39 +0000 (UTC) (envelope-from tim@kientzle.com) Subject: Re: jemalloc enhancement for small-memory systems Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <1356204505.1129.21.camel@revolution.hippie.lan> Date: Sat, 22 Dec 2012 14:40:39 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <75ECE5AB-9276-44BA-84D7-56EF6BDC3984@kientzle.com> References: <1356204505.1129.21.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1283) Cc: Jason Evans , 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: Sat, 22 Dec 2012 22:40:43 -0000 On Dec 22, 2012, at 11:28 AM, Ian Lepore wrote: > When a daemon such as watchdogd uses mlockall(2) on a small-memory > embedded system, it can end up wiring much of the available ram = because > jemalloc allocates large chunks of vmspace by default. More = background > info on this can be found in this thread: >=20 > = http://lists.freebsd.org/pipermail/freebsd-embedded/2012-November/001679.h= tml >=20 > It's hard to tune jemalloc's allocation behavior for this in a > machine-independent way because the minimum chunk size depends on > PAGE_SIZE and other factors internal to jemalloc. I've created a = patch > that addresses this by defining that lg_chunk:0 is implicitly a = request > to set the chunk size to the smallest value allowable for the machine > it's running on. The patch is attached to this PR... >=20 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D174641 >=20 > Jason, could you please review this and consider incorporating it into > jemalloc? Or let us know if there's a better way to handle this > situation. Would it be feasible for jemalloc to initially allocate small blocks (to not over-allocate for small programs and systems with small RAM) and then allocate successively larger blocks as the program requires more memory? Tim