svn commit: r325965 - head/libexec/rtld-elf

Konstantin Belousov kostikbel at gmail.com
Sat Nov 18 14:10:21 UTC 2017


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();
>  


More information about the svn-src-head mailing list