Replace --disable-munmap with opt.munmap.

Control use of munmap(2) via a run-time option rather than a
compile-time option (with the same per platform default).  The old
behavior of --disable-munmap can be achieved with
--with-malloc-conf=munmap:false.

This partially resolves #580.
This commit is contained in:
Jason Evans
2017-04-24 17:28:55 -07:00
parent e2cc6280ed
commit c67c3e4a63
16 changed files with 77 additions and 85 deletions

View File

@@ -788,16 +788,6 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
during build configuration.</para></listitem>
</varlistentry>
<varlistentry id="config.munmap">
<term>
<mallctl>config.munmap</mallctl>
(<type>bool</type>)
<literal>r-</literal>
</term>
<listitem><para><option>--enable-munmap</option> was specified during
build configuration.</para></listitem>
</varlistentry>
<varlistentry id="config.prof">
<term>
<mallctl>config.prof</mallctl>
@@ -873,6 +863,28 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
</para></listitem>
</varlistentry>
<varlistentry id="opt.munmap">
<term>
<mallctl>opt.munmap</mallctl>
(<type>bool</type>)
<literal>r-</literal>
</term>
<listitem><para>If true, call
<citerefentry><refentrytitle>munmap</refentrytitle>
<manvolnum>2</manvolnum></citerefentry> or equivalent rather than
retaining unused virtual memory (see <link
linkend="stats.retained">stats.retained</link> for related details).
This option is enabled by default unless it is known to trigger
platform-specific performance problems, e.g. for [64-bit] Linux, which
has a quirk in its virtual memory allocation algorithm that causes
semi-permanent VM map holes under normal jemalloc operation. Although
<citerefentry><refentrytitle>munmap</refentrytitle>
<manvolnum>2</manvolnum></citerefentry> causes issues on 32-bit Linux as
well, it is not disabled by default due to the practical possibility of
address space exhaustion.
</para></listitem>
</varlistentry>
<varlistentry id="opt.dss">
<term>
<mallctl>opt.dss</mallctl>
@@ -2114,9 +2126,9 @@ struct extent_hooks_s {
<listitem><para>Total number of bytes in virtual memory mappings that
were retained rather than being returned to the operating system via
e.g. <citerefentry><refentrytitle>munmap</refentrytitle>
<manvolnum>2</manvolnum></citerefentry>. Retained virtual memory is
typically untouched, decommitted, or purged, so it has no strongly
associated physical memory (see <link
<manvolnum>2</manvolnum></citerefentry> or similar. Retained virtual
memory is typically untouched, decommitted, or purged, so it has no
strongly associated physical memory (see <link
linkend="arena.i.extent_hooks">extent hooks</link> for details).
Retained memory is excluded from mapped memory statistics, e.g. <link
linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>.