From owner-svn-src-head@freebsd.org Sat Nov 18 14:10:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC767DBBC81; Sat, 18 Nov 2017 14:10:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CFBA70C50; Sat, 18 Nov 2017 14:10:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id vAIEA8aw066394 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 18 Nov 2017 16:10:09 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua vAIEA8aw066394 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id vAIEA7a9066388; Sat, 18 Nov 2017 16:10:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 18 Nov 2017 16:10:07 +0200 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r325965 - head/libexec/rtld-elf Message-ID: <20171118141007.GI2272@kib.kiev.ua> References: <201711181321.vAIDLM6S028725@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201711181321.vAIDLM6S028725@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 18 Nov 2017 14:10:21 -0000 On Sat, Nov 18, 2017 at 01:21:22PM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sat Nov 18 13:21:22 2017 > New Revision: 325965 > URL: https://svnweb.freebsd.org/changeset/base/325965 > > Log: > Increase rtld initial memory pool size from 32kB to 128kB. > > The old value was probably fine back in 1998, when that code was imported > (although the comments still mention VAX, which was quite obsolete by then); > now, however, it's too small to handle our libc, which results in some > additional calls to munmap/mmap later on. Asking for more virtual address > space is virtually free, and syscalls are not, thus the change. > > It was suggested by kib@ that this might be a symptom of a deeper problem. > It doesn't only affect libc, though - the change also improves rtld memory > management for eg KDE libraries. I guess it's just a natural bloat. This is not what I said. My guess was that the large allocation you see in the ktrace output as coming from rtld was really an allocation of the TLS segment, and it was so large because libc has that large TLS segment. You did not checked this guess against the actual code. If my guess is true, I do not see a point in the change you made: the memory consumption is externally imposed on rtld, and we should not try to tailor it to single, whenever important, consumer. > > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D12834 > > Modified: > head/libexec/rtld-elf/malloc.c > > Modified: head/libexec/rtld-elf/malloc.c > ============================================================================== > --- head/libexec/rtld-elf/malloc.c Sat Nov 18 11:58:35 2017 (r325964) > +++ head/libexec/rtld-elf/malloc.c Sat Nov 18 13:21:22 2017 (r325965) > @@ -61,7 +61,7 @@ static int findbucket(); > /* > * Pre-allocate mmap'ed pages > */ > -#define NPOOLPAGES (32*1024/pagesz) > +#define NPOOLPAGES (128*1024/pagesz) > static caddr_t pagepool_start, pagepool_end; > static int morepages(); >