aboutsummaryrefslogtreecommitdiff
path: root/tests/malloc_manysmall.c
diff options
context:
space:
mode:
authorEric B Munson <emunson@mgebm.net>2010-11-23 08:52:17 -0700
committerEric B Munson <emunson@mgebm.net>2010-11-29 13:41:49 -0700
commitc14a6c872d9806d98a1545ce7a117aaa5719af58 (patch)
treede8e9dc1c67b13e092d5c28499a0b3a600283d83 /tests/malloc_manysmall.c
parent8a5425ed8255acc00dd5108d498329d5ef8b728f (diff)
downloadlibhugetlbfs-c14a6c872d9806d98a1545ce7a117aaa5719af58.tar.gz
Convert heap tests to use get_mapping_page_size
Convert all the heap based tests to use get_mapping_page_size to check if a mapping is backed by huge pages now that morecore uses MAP_HUGETLB. Signed-off-by: Eric B Munson <emunson@mgebm.net>
Diffstat (limited to 'tests/malloc_manysmall.c')
-rw-r--r--tests/malloc_manysmall.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/malloc_manysmall.c b/tests/malloc_manysmall.c
index ae10b80..25086a8 100644
--- a/tests/malloc_manysmall.c
+++ b/tests/malloc_manysmall.c
@@ -25,6 +25,14 @@
#include "hugetests.h"
+/*
+ * We cannot test mapping size against huge page size because we are not linked
+ * against libhugetlbfs so gethugepagesize() won't work. So instead we define
+ * our MIN_PAGE_SIZE as 64 kB (the largest base page available) and make sure
+ * the mapping page size is larger than this.
+ */
+#define MIN_PAGE_SIZE 65536
+
#define ALLOC_SIZE (128)
#define NUM_ALLOCS (262144)
@@ -55,9 +63,11 @@ int main(int argc, char *argv[])
if ((i % 157) == 0) {
/* With this many allocs, testing every one
* takes forever */
- if (expect_hugepage && (test_addr_huge(p) != 1))
+ unsigned long long mapping_size =
+ get_mapping_page_size(p);
+ if (expect_hugepage && (mapping_size <= MIN_PAGE_SIZE))
FAIL("Address is not hugepage");
- if (!expect_hugepage && (test_addr_huge(p) == 1))
+ if (!expect_hugepage && (mapping_size > MIN_PAGE_SIZE))
FAIL("Address is unexpectedly huge");
}
}