enabling mpss on solaris/illumos.
reusing slighty linux configuration as possible, aligning the address range to HUGEPAGE.
This commit is contained in:
parent
c2e7a06392
commit
00f06c9beb
@ -1879,6 +1879,14 @@ if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
|
|||||||
wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
|
wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_FUNC([memcntl],
|
||||||
|
[have_memcntl="1"],
|
||||||
|
[have_memcntl="0"],
|
||||||
|
)
|
||||||
|
if test "x$have_memcntl" = "x1" ; then
|
||||||
|
AC_DEFINE([JEMALLOC_HAVE_MEMCNTL], [ ])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Disable lazy locking by default.
|
dnl Disable lazy locking by default.
|
||||||
AC_ARG_ENABLE([lazy_lock],
|
AC_ARG_ENABLE([lazy_lock],
|
||||||
[AS_HELP_STRING([--enable-lazy-lock],
|
[AS_HELP_STRING([--enable-lazy-lock],
|
||||||
|
@ -301,6 +301,11 @@
|
|||||||
*/
|
*/
|
||||||
#undef JEMALLOC_THP
|
#undef JEMALLOC_THP
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defined if memcntl page admin call is supported
|
||||||
|
*/
|
||||||
|
#undef JEMALLOC_HAVE_MEMCNTL
|
||||||
|
|
||||||
/* Define if operating system has alloca.h header. */
|
/* Define if operating system has alloca.h header. */
|
||||||
#undef JEMALLOC_HAS_ALLOCA_H
|
#undef JEMALLOC_HAS_ALLOCA_H
|
||||||
|
|
||||||
|
@ -217,4 +217,12 @@ static const bool config_high_res_timer =
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
static const bool have_memcntl =
|
||||||
|
#ifdef JEMALLOC_HAVE_MEMCNTL
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
#endif /* JEMALLOC_PREAMBLE_H */
|
#endif /* JEMALLOC_PREAMBLE_H */
|
||||||
|
@ -1533,7 +1533,7 @@ malloc_conf_init_helper(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
|
|||||||
for (int i = 0; i < thp_mode_names_limit; i++) {
|
for (int i = 0; i < thp_mode_names_limit; i++) {
|
||||||
if (strncmp(thp_mode_names[i],v, vlen)
|
if (strncmp(thp_mode_names[i],v, vlen)
|
||||||
== 0) {
|
== 0) {
|
||||||
if (!have_madvise_huge) {
|
if (!have_madvise_huge && !have_memcntl) {
|
||||||
CONF_ERROR(
|
CONF_ERROR(
|
||||||
"No THP support",
|
"No THP support",
|
||||||
k, klen, v, vlen);
|
k, klen, v, vlen);
|
||||||
|
15
src/pages.c
15
src/pages.c
@ -363,8 +363,13 @@ pages_huge_impl(void *addr, size_t size, bool aligned) {
|
|||||||
assert(HUGEPAGE_ADDR2BASE(addr) == addr);
|
assert(HUGEPAGE_ADDR2BASE(addr) == addr);
|
||||||
assert(HUGEPAGE_CEILING(size) == size);
|
assert(HUGEPAGE_CEILING(size) == size);
|
||||||
}
|
}
|
||||||
#ifdef JEMALLOC_HAVE_MADVISE_HUGE
|
#if defined(JEMALLOC_HAVE_MADVISE_HUGE)
|
||||||
return (madvise(addr, size, MADV_HUGEPAGE) != 0);
|
return (madvise(addr, size, MADV_HUGEPAGE) != 0);
|
||||||
|
#elif defined(JEMALLOC_HAVE_MEMCNTL)
|
||||||
|
struct memcntl_mha m = {0};
|
||||||
|
m.mha_cmd = MHA_MAPSIZE_VA;
|
||||||
|
m.mha_pagesize = HUGEPAGE;
|
||||||
|
return (memcntl(addr, size, MC_HAT_ADVISE, (caddr_t)&m, 0, 0) == 0);
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@ -561,14 +566,14 @@ pages_set_thp_state (void *ptr, size_t size) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
init_thp_state(void) {
|
init_thp_state(void) {
|
||||||
if (!have_madvise_huge) {
|
if (!have_madvise_huge && !have_memcntl) {
|
||||||
if (metadata_thp_enabled() && opt_abort) {
|
if (metadata_thp_enabled() && opt_abort) {
|
||||||
malloc_write("<jemalloc>: no MADV_HUGEPAGE support\n");
|
malloc_write("<jemalloc>: no MADV_HUGEPAGE support\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
goto label_error;
|
goto label_error;
|
||||||
}
|
}
|
||||||
|
#if defined(JEMALLOC_HAVE_MADVISE_HUGE)
|
||||||
static const char sys_state_madvise[] = "always [madvise] never\n";
|
static const char sys_state_madvise[] = "always [madvise] never\n";
|
||||||
static const char sys_state_always[] = "[always] madvise never\n";
|
static const char sys_state_always[] = "[always] madvise never\n";
|
||||||
static const char sys_state_never[] = "always madvise [never]\n";
|
static const char sys_state_never[] = "always madvise [never]\n";
|
||||||
@ -608,6 +613,10 @@ init_thp_state(void) {
|
|||||||
goto label_error;
|
goto label_error;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
#elif defined(JEMALLOC_HAVE_MEMCNTL)
|
||||||
|
init_system_thp_mode = thp_mode_default;
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
label_error:
|
label_error:
|
||||||
opt_thp = init_system_thp_mode = thp_mode_not_supported;
|
opt_thp = init_system_thp_mode = thp_mode_not_supported;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user