2016-11-18 05:36:17 +08:00
|
|
|
#include "test/jemalloc_test.h"
|
|
|
|
|
2017-01-16 08:56:30 +08:00
|
|
|
TEST_BEGIN(test_pages_huge) {
|
2016-11-18 05:36:17 +08:00
|
|
|
size_t alloc_size;
|
|
|
|
bool commit;
|
|
|
|
void *pages, *hugepage;
|
|
|
|
|
|
|
|
alloc_size = HUGEPAGE * 2 - PAGE;
|
|
|
|
commit = true;
|
2017-04-17 07:23:32 +08:00
|
|
|
pages = pages_map(NULL, alloc_size, PAGE, &commit);
|
2016-11-18 05:36:17 +08:00
|
|
|
assert_ptr_not_null(pages, "Unexpected pages_map() error");
|
|
|
|
|
|
|
|
hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
|
2017-08-12 06:41:52 +08:00
|
|
|
assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_madvise_huge,
|
2016-11-18 05:36:17 +08:00
|
|
|
"Unexpected pages_huge() result");
|
|
|
|
assert_false(pages_nohuge(hugepage, HUGEPAGE),
|
|
|
|
"Unexpected pages_nohuge() result");
|
|
|
|
|
|
|
|
pages_unmap(pages, alloc_size);
|
|
|
|
}
|
|
|
|
TEST_END
|
|
|
|
|
|
|
|
int
|
2017-01-16 08:56:30 +08:00
|
|
|
main(void) {
|
2017-01-20 10:15:45 +08:00
|
|
|
return test(
|
|
|
|
test_pages_huge);
|
2016-11-18 05:36:17 +08:00
|
|
|
}
|