Fix test/unit/pages.
As part of the metadata_thp support, We now have a separate swtich (JEMALLOC_HAVE_MADVISE_HUGE) for MADV_HUGEPAGE availability. Use that instead of JEMALLOC_THP (which doesn't guard pages_huge anymore) in tests.
This commit is contained in:
parent
8fdd9a5797
commit
3ec279ba1c
@ -61,6 +61,13 @@ static const bool have_dss =
|
|||||||
false
|
false
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
static const bool have_madvise_huge =
|
||||||
|
#ifdef JEMALLOC_HAVE_MADVISE_HUGE
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
;
|
||||||
static const bool config_fill =
|
static const bool config_fill =
|
||||||
#ifdef JEMALLOC_FILL
|
#ifdef JEMALLOC_FILL
|
||||||
true
|
true
|
||||||
|
13
src/pages.c
13
src/pages.c
@ -417,13 +417,14 @@ os_overcommits_proc(void) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
init_thp_state(void) {
|
init_thp_state(void) {
|
||||||
#ifndef JEMALLOC_HAVE_MADVISE_HUGE
|
if (!have_madvise_huge) {
|
||||||
if (opt_metadata_thp && opt_abort) {
|
if (opt_metadata_thp && 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;
|
|
||||||
#endif
|
|
||||||
static const char madvise_state[] = "always [madvise] never\n";
|
static const char madvise_state[] = "always [madvise] never\n";
|
||||||
char buf[sizeof(madvise_state)];
|
char buf[sizeof(madvise_state)];
|
||||||
|
|
||||||
|
@ -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), config_thp,
|
assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_madvise_huge,
|
||||||
"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