From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 31 17:27:08 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 EDA328AF for ; Wed, 31 Oct 2012 17:27:07 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id AF7A58FC14 for ; Wed, 31 Oct 2012 17:27:07 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [172.17.17.101]) by email2.allantgroup.com (8.14.5/8.14.5) with ESMTP id q9VHLbbN023662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Oct 2012 12:21:37 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.5/8.14.5) with ESMTP id q9VHLbja023951 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Oct 2012 12:21:37 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.5/8.14.5/Submit) id q9VHLa2u023950; Wed, 31 Oct 2012 12:21:36 -0500 (CDT) (envelope-from dan) Date: Wed, 31 Oct 2012 12:21:36 -0500 From: Dan Nelson To: Karl Pielorz Subject: Re: Threaded 6.4 code compiled under 9.0 uses a lot more memory?.. Message-ID: <20121031172136.GB21003@dan.emsphone.com> References: <20121030182727.48f5e649@X220.ovitrap.com> <20121030194307.57e5c5a3@X220.ovitrap.com> <615577FED019BCA31EC4211B@Octca64MkIV.tdx.co.uk> <509012D3.5060705@mu.org> <20121030175138.GA73505@kib.kiev.ua> <20121031140630.GE73505@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 8.3-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.97.6 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (email2.allantgroup.com [172.17.19.78]); Wed, 31 Oct 2012 12:21:38 -0500 (CDT) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on email2.allantgroup.com X-Scanned-By: MIMEDefang 2.73 Cc: Konstantin Belousov , freebsd-hackers@freebsd.org, Alfred Perlstein 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: Wed, 31 Oct 2012 17:27:08 -0000 In the last episode (Oct 31), Karl Pielorz said: > --On 31 October 2012 16:06 +0200 Konstantin Belousov wrote: > > Since you neglected to provide the verbatim output of procstat, nothing > > conclusive can be said. Obviously, you can make an investigation on > > your own. > > Sorry - when I ran it this morning the output was several hundred lines - > I didn't want to post all of that to the list 99% of the lines are very > similar. I can email it you off-list if having the whole lot will help? > > >> Then there's a bunch of 'large' blocks e.g.. > >> > >> PID START END PRT RES PRES REF SHD FL TP > >> PATH 2010 0x801c00000 0x802800000 rw- 2869 0 4 0 > >> ---- df 2010 0x802800000 0x803400000 rw- 1880 0 1 0 > > > > Most likely, these are malloc arenas. > > Ok, that's the heaviest usage. > > >> Then lots of 'little' blocks, > >> > >> 2010 0x7ffff0161000 0x7ffff0181000 rw- 16 0 1 0 ---D df > > > > And those are thread stacks. > > Ok, lots of those (lots of threads going on) - but they're all pretty > small. > > My code only has a single call to malloc, which allocates around 20k per > thread. > > Obviously there's other libraries and stuff running with the code - so > would I be correct in guessing that they are more than likely for most of > these large blocks? Note that libmilter may do a lot of mallocs on its own, especially if you are examining the message body. There are also jemalloc tuning options that may lower total meory usage if you are using a lot of threads. I'd take a look at the G and R flags first. -- Dan Nelson dnelson@allantgroup.com