Add the --disable-thp option to support cross compiling.
This resolves #669.
This commit is contained in:
parent
bf6673a070
commit
c606a87d2a
@ -157,6 +157,11 @@ any of the following arguments (not a definitive list) to 'configure':
|
|||||||
Statically link against the specified libunwind.a rather than dynamically
|
Statically link against the specified libunwind.a rather than dynamically
|
||||||
linking with -lunwind.
|
linking with -lunwind.
|
||||||
|
|
||||||
|
* `--disable-thp`
|
||||||
|
|
||||||
|
Disable transparent huge page (THP) integration. This option can be useful
|
||||||
|
when cross compiling.
|
||||||
|
|
||||||
* `--disable-fill`
|
* `--disable-fill`
|
||||||
|
|
||||||
Disable support for junk/zero filling of memory. See the "opt.junk" and
|
Disable support for junk/zero filling of memory. See the "opt.junk" and
|
||||||
@ -224,7 +229,7 @@ any of the following arguments (not a definitive list) to 'configure':
|
|||||||
* `--with-lg-page-sizes=<lg-page-sizes>`
|
* `--with-lg-page-sizes=<lg-page-sizes>`
|
||||||
|
|
||||||
Specify the comma-separated base 2 logs of the page sizes to support. This
|
Specify the comma-separated base 2 logs of the page sizes to support. This
|
||||||
option may be useful when cross-compiling in combination with
|
option may be useful when cross compiling in combination with
|
||||||
`--with-lg-page`, but its primary use case is for integration with FreeBSD's
|
`--with-lg-page`, but its primary use case is for integration with FreeBSD's
|
||||||
libc, wherein jemalloc is embedded.
|
libc, wherein jemalloc is embedded.
|
||||||
|
|
||||||
|
23
configure.ac
23
configure.ac
@ -1792,10 +1792,28 @@ if test "x${je_cv_madvise}" = "xyes" ; then
|
|||||||
madvise((void *)0, 0, MADV_HUGEPAGE);
|
madvise((void *)0, 0, MADV_HUGEPAGE);
|
||||||
madvise((void *)0, 0, MADV_NOHUGEPAGE);
|
madvise((void *)0, 0, MADV_NOHUGEPAGE);
|
||||||
], [je_cv_thp])
|
], [je_cv_thp])
|
||||||
if test "x${je_cv_thp}" = "xyes" ; then
|
fi
|
||||||
|
|
||||||
|
dnl Enable transparent huge page support by default.
|
||||||
|
AC_ARG_ENABLE([thp],
|
||||||
|
[AS_HELP_STRING([--disable-thp],
|
||||||
|
[Disable transparent huge page support])],
|
||||||
|
[if test "x$enable_thp" = "xno" -o "x${je_cv_thp}" != "xyes" ; then
|
||||||
|
enable_thp="0"
|
||||||
|
else
|
||||||
|
enable_thp="1"
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[if test "x${je_cv_thp}" = "xyes" ; then
|
||||||
|
enable_thp="1"
|
||||||
|
else
|
||||||
|
enable_thp="0"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
if test "x$enable_thp" = "x1" ; then
|
||||||
AC_DEFINE([JEMALLOC_THP], [ ])
|
AC_DEFINE([JEMALLOC_THP], [ ])
|
||||||
fi
|
fi
|
||||||
fi
|
AC_SUBST([enable_thp])
|
||||||
|
|
||||||
dnl ============================================================================
|
dnl ============================================================================
|
||||||
dnl Check whether __sync_{add,sub}_and_fetch() are available despite
|
dnl Check whether __sync_{add,sub}_and_fetch() are available despite
|
||||||
@ -2141,6 +2159,7 @@ AC_MSG_RESULT([prof : ${enable_prof}])
|
|||||||
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
|
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
|
||||||
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
|
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
|
||||||
AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
|
AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
|
||||||
|
AC_MSG_RESULT([thp : ${enable_thp}])
|
||||||
AC_MSG_RESULT([fill : ${enable_fill}])
|
AC_MSG_RESULT([fill : ${enable_fill}])
|
||||||
AC_MSG_RESULT([utrace : ${enable_utrace}])
|
AC_MSG_RESULT([utrace : ${enable_utrace}])
|
||||||
AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
|
AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
|
||||||
|
@ -849,6 +849,17 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
|||||||
build configuration.</para></listitem>
|
build configuration.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry id="config.thp">
|
||||||
|
<term>
|
||||||
|
<mallctl>config.thp</mallctl>
|
||||||
|
(<type>bool</type>)
|
||||||
|
<literal>r-</literal>
|
||||||
|
</term>
|
||||||
|
<listitem><para><option>--disable-thp</option> was not specified
|
||||||
|
during build configuration, and the system supports transparent huge
|
||||||
|
page manipulation.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry id="config.utrace">
|
<varlistentry id="config.utrace">
|
||||||
<term>
|
<term>
|
||||||
<mallctl>config.utrace</mallctl>
|
<mallctl>config.utrace</mallctl>
|
||||||
|
@ -269,8 +269,8 @@
|
|||||||
#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS
|
#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
|
* Defined if transparent huge pages (THPs) are supported via the
|
||||||
* arguments to madvise(2).
|
* MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.
|
||||||
*/
|
*/
|
||||||
#undef JEMALLOC_THP
|
#undef JEMALLOC_THP
|
||||||
|
|
||||||
|
@ -111,6 +111,13 @@ static const bool config_stats =
|
|||||||
false
|
false
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
static const bool config_thp =
|
||||||
|
#ifdef JEMALLOC_THP
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
;
|
||||||
static const bool config_tls =
|
static const bool config_tls =
|
||||||
#ifdef JEMALLOC_TLS
|
#ifdef JEMALLOC_TLS
|
||||||
true
|
true
|
||||||
@ -139,13 +146,6 @@ static const bool config_cache_oblivious =
|
|||||||
false
|
false
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
static const bool have_thp =
|
|
||||||
#ifdef JEMALLOC_THP
|
|
||||||
true
|
|
||||||
#else
|
|
||||||
false
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
#ifdef JEMALLOC_HAVE_SCHED_GETCPU
|
#ifdef JEMALLOC_HAVE_SCHED_GETCPU
|
||||||
/* Currently percpu_arena depends on sched_getcpu. */
|
/* Currently percpu_arena depends on sched_getcpu. */
|
||||||
#define JEMALLOC_PERCPU_ARENA
|
#define JEMALLOC_PERCPU_ARENA
|
||||||
|
@ -73,6 +73,7 @@ CTL_PROTO(config_prof)
|
|||||||
CTL_PROTO(config_prof_libgcc)
|
CTL_PROTO(config_prof_libgcc)
|
||||||
CTL_PROTO(config_prof_libunwind)
|
CTL_PROTO(config_prof_libunwind)
|
||||||
CTL_PROTO(config_stats)
|
CTL_PROTO(config_stats)
|
||||||
|
CTL_PROTO(config_thp)
|
||||||
CTL_PROTO(config_utrace)
|
CTL_PROTO(config_utrace)
|
||||||
CTL_PROTO(config_xmalloc)
|
CTL_PROTO(config_xmalloc)
|
||||||
CTL_PROTO(opt_abort)
|
CTL_PROTO(opt_abort)
|
||||||
@ -263,6 +264,7 @@ static const ctl_named_node_t config_node[] = {
|
|||||||
{NAME("prof_libgcc"), CTL(config_prof_libgcc)},
|
{NAME("prof_libgcc"), CTL(config_prof_libgcc)},
|
||||||
{NAME("prof_libunwind"), CTL(config_prof_libunwind)},
|
{NAME("prof_libunwind"), CTL(config_prof_libunwind)},
|
||||||
{NAME("stats"), CTL(config_stats)},
|
{NAME("stats"), CTL(config_stats)},
|
||||||
|
{NAME("thp"), CTL(config_thp)},
|
||||||
{NAME("utrace"), CTL(config_utrace)},
|
{NAME("utrace"), CTL(config_utrace)},
|
||||||
{NAME("xmalloc"), CTL(config_xmalloc)}
|
{NAME("xmalloc"), CTL(config_xmalloc)}
|
||||||
};
|
};
|
||||||
@ -1544,6 +1546,7 @@ CTL_RO_CONFIG_GEN(config_prof, bool)
|
|||||||
CTL_RO_CONFIG_GEN(config_prof_libgcc, bool)
|
CTL_RO_CONFIG_GEN(config_prof_libgcc, bool)
|
||||||
CTL_RO_CONFIG_GEN(config_prof_libunwind, bool)
|
CTL_RO_CONFIG_GEN(config_prof_libunwind, bool)
|
||||||
CTL_RO_CONFIG_GEN(config_stats, bool)
|
CTL_RO_CONFIG_GEN(config_stats, bool)
|
||||||
|
CTL_RO_CONFIG_GEN(config_thp, bool)
|
||||||
CTL_RO_CONFIG_GEN(config_utrace, bool)
|
CTL_RO_CONFIG_GEN(config_utrace, bool)
|
||||||
CTL_RO_CONFIG_GEN(config_xmalloc, bool)
|
CTL_RO_CONFIG_GEN(config_xmalloc, bool)
|
||||||
|
|
||||||
|
@ -725,6 +725,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
CONFIG_WRITE_BOOL_JSON(prof_libgcc, ",")
|
CONFIG_WRITE_BOOL_JSON(prof_libgcc, ",")
|
||||||
CONFIG_WRITE_BOOL_JSON(prof_libunwind, ",")
|
CONFIG_WRITE_BOOL_JSON(prof_libunwind, ",")
|
||||||
CONFIG_WRITE_BOOL_JSON(stats, ",")
|
CONFIG_WRITE_BOOL_JSON(stats, ",")
|
||||||
|
CONFIG_WRITE_BOOL_JSON(thp, ",")
|
||||||
CONFIG_WRITE_BOOL_JSON(utrace, ",")
|
CONFIG_WRITE_BOOL_JSON(utrace, ",")
|
||||||
CONFIG_WRITE_BOOL_JSON(xmalloc, "")
|
CONFIG_WRITE_BOOL_JSON(xmalloc, "")
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ TEST_BEGIN(test_pages_huge) {
|
|||||||
assert_ptr_not_null(pages, "Unexpected pages_map() error");
|
assert_ptr_not_null(pages, "Unexpected pages_map() error");
|
||||||
|
|
||||||
hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
|
hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
|
||||||
assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_thp,
|
assert_b_ne(pages_huge(hugepage, HUGEPAGE), config_thp,
|
||||||
"Unexpected pages_huge() result");
|
"Unexpected pages_huge() result");
|
||||||
assert_false(pages_nohuge(hugepage, HUGEPAGE),
|
assert_false(pages_nohuge(hugepage, HUGEPAGE),
|
||||||
"Unexpected pages_nohuge() result");
|
"Unexpected pages_nohuge() result");
|
||||||
|
Loading…
Reference in New Issue
Block a user