server-skynet-source-3rd-je.../test/unit/pages.c
Jason Evans da4cff0279 Support --with-lg-page values larger than system page size.
All mappings continue to be PAGE-aligned, even if the system page size
is smaller.  This change is primarily intended to provide a mechanism
for supporting multiple page sizes with the same binary; smaller page
sizes work better in conjunction with jemalloc's design.

This resolves #467.
2017-04-18 19:01:04 -07:00

28 lines
645 B
C

#include "test/jemalloc_test.h"
TEST_BEGIN(test_pages_huge) {
size_t alloc_size;
bool commit;
void *pages, *hugepage;
alloc_size = HUGEPAGE * 2 - PAGE;
commit = true;
pages = pages_map(NULL, alloc_size, PAGE, &commit);
assert_ptr_not_null(pages, "Unexpected pages_map() error");
hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_thp,
"Unexpected pages_huge() result");
assert_false(pages_nohuge(hugepage, HUGEPAGE),
"Unexpected pages_nohuge() result");
pages_unmap(pages, alloc_size);
}
TEST_END
int
main(void) {
return test(
test_pages_huge);
}