1a0698ed9Schristos #include "test/jemalloc_test.h" 2a0698ed9Schristos 3a0698ed9Schristos TEST_BEGIN(test_pages_huge) { 4a0698ed9Schristos size_t alloc_size; 5a0698ed9Schristos bool commit; 6a0698ed9Schristos void *pages, *hugepage; 7a0698ed9Schristos 8a0698ed9Schristos alloc_size = HUGEPAGE * 2 - PAGE; 9a0698ed9Schristos commit = true; 10a0698ed9Schristos pages = pages_map(NULL, alloc_size, PAGE, &commit); 11*7bdf38e5Schristos expect_ptr_not_null(pages, "Unexpected pages_map() error"); 12a0698ed9Schristos 13a0698ed9Schristos if (init_system_thp_mode == thp_mode_default) { 14a0698ed9Schristos hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE)); 15*7bdf38e5Schristos expect_b_ne(pages_huge(hugepage, HUGEPAGE), have_madvise_huge, 16a0698ed9Schristos "Unexpected pages_huge() result"); 17*7bdf38e5Schristos expect_false(pages_nohuge(hugepage, HUGEPAGE), 18a0698ed9Schristos "Unexpected pages_nohuge() result"); 19a0698ed9Schristos } 20a0698ed9Schristos 21a0698ed9Schristos pages_unmap(pages, alloc_size); 22a0698ed9Schristos } 23a0698ed9Schristos TEST_END 24a0698ed9Schristos 25a0698ed9Schristos int 26a0698ed9Schristos main(void) { 27a0698ed9Schristos return test( 28a0698ed9Schristos test_pages_huge); 29a0698ed9Schristos } 30