From owner-freebsd-hackers@FreeBSD.ORG Sat Nov 3 18:41:52 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81827694; Sat, 3 Nov 2012 18:41:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kostikbel-1-pt.tunnel.tserv11.ams1.ipv6.he.net [IPv6:2001:470:1f14:13d6::2]) by mx1.freebsd.org (Postfix) with ESMTP id DBA558FC08; Sat, 3 Nov 2012 18:41:51 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qA3Ifh4X020600; Sat, 3 Nov 2012 20:41:43 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qA3IfhMX020599; Sat, 3 Nov 2012 20:41:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Nov 2012 20:41:43 +0200 From: Konstantin Belousov To: Ian Lepore Subject: Re: watchdogd, jemalloc, and mlockall Message-ID: <20121103184143.GC73505@kib.kiev.ua> References: <1351967919.1120.102.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="I0oWFe1KborvVxk0" Content-Disposition: inline In-Reply-To: <1351967919.1120.102.camel@revolution.hippie.lan> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org, freebsd-embedded@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2012 18:41:52 -0000 --I0oWFe1KborvVxk0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 03, 2012 at 12:38:39PM -0600, Ian Lepore wrote: > In an attempt to un-hijack the thread about memory usage increase > between 6.4 and 9.x, I'm starting a new thread here related to my recent > discovery that watchdogd uses a lot more memory since it began using > mlockall(2). >=20 > I tried statically linking watchdogd and it made a small difference in > RSS, presumably because it doesn't wire down all of libc and libm. >=20 > VSZ RSS > 10236 10164 Dynamic > 8624 8636 Static >=20 > Those numbers are from ps -u on an arm platform. I just updated the PR > (bin/173332) with some procstat -v output comparing with/without > mlockall(). >=20 > It appears that the bulk of the new RSS bloat comes from jemalloc > allocating vmspace in 8MB chunks. With mlockall(MCL_FUTURE) in effect > that leads to wiring 8MB to satisfy what probably amounts to a few > hundred bytes of malloc'd memory. >=20 > It would probably also be a good idea to remove the floating point from > watchdogd to avoid wiring all of libm. The floating point is used just > to turn the timeout-in-seconds into a power-of-two-nanoseconds value. > There's probably a reasonably efficient way to do that without calling > log(), considering that it only happens once at program startup. No, I propose to add a switch to turn on/off the mlockall() call. I have no opinion on the default value of the suggested switch. --I0oWFe1KborvVxk0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCVZWcACgkQC3+MBN1Mb4hHhACguk/G8KdOYC2wQMMu6BH1WI8c BlkAnRwhcgc8SnQ62sV90VvzzrvX+cLf =s6o/ -----END PGP SIGNATURE----- --I0oWFe1KborvVxk0--