summaryrefslogtreecommitdiffstats
path: root/include/jemalloc/internal/pages.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-11-17 21:36:17 (GMT)
committerJason Evans <jasone@canonware.com>2016-12-27 01:59:34 (GMT)
commitc1baa0a9b7b05ebf98221dc7deb12c28e170a399 (patch)
treec750107c4d3da8bc4222961866267e2939fb6241 /include/jemalloc/internal/pages.h
parenteab3b180e59d6b23fee5fd2165f96402e7341cba (diff)
downloadjemalloc-c1baa0a9b7b05ebf98221dc7deb12c28e170a399.zip
jemalloc-c1baa0a9b7b05ebf98221dc7deb12c28e170a399.tar.gz
jemalloc-c1baa0a9b7b05ebf98221dc7deb12c28e170a399.tar.bz2
Add huge page configuration and pages_[no}huge().
Add the --with-lg-hugepage configure option, but automatically configure LG_HUGEPAGE even if it isn't specified. Add the pages_[no]huge() functions, which toggle huge page state via madvise(..., MADV_[NO]HUGEPAGE) calls.
Diffstat (limited to 'include/jemalloc/internal/pages.h')
-rw-r--r--include/jemalloc/internal/pages.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/jemalloc/internal/pages.h b/include/jemalloc/internal/pages.h
index 16c657a..034a8aa 100644
--- a/include/jemalloc/internal/pages.h
+++ b/include/jemalloc/internal/pages.h
@@ -7,15 +7,23 @@
#endif
#define PAGE ((size_t)(1U << LG_PAGE))
#define PAGE_MASK ((size_t)(PAGE - 1))
-
/* Return the page base address for the page containing address a. */
#define PAGE_ADDR2BASE(a) \
((void *)((uintptr_t)(a) & ~PAGE_MASK))
-
/* Return the smallest pagesize multiple that is >= s. */
#define PAGE_CEILING(s) \
(((s) + PAGE_MASK) & ~PAGE_MASK)
+/* Huge page size. LG_HUGEPAGE is determined by the configure script. */
+#define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE))
+#define HUGEPAGE_MASK ((size_t)(HUGEPAGE - 1))
+/* Return the huge page base address for the huge page containing address a. */
+#define HUGEPAGE_ADDR2BASE(a) \
+ ((void *)((uintptr_t)(a) & ~HUGEPAGE_MASK))
+/* Return the smallest pagesize multiple that is >= s. */
+#define HUGEPAGE_CEILING(s) \
+ (((s) + HUGEPAGE_MASK) & ~HUGEPAGE_MASK)
+
#endif /* JEMALLOC_H_TYPES */
/******************************************************************************/
#ifdef JEMALLOC_H_STRUCTS
@@ -31,6 +39,8 @@ void *pages_trim(void *addr, size_t alloc_size, size_t leadsize,
bool pages_commit(void *addr, size_t size);
bool pages_decommit(void *addr, size_t size);
bool pages_purge(void *addr, size_t size);
+bool pages_huge(void *addr, size_t size);
+bool pages_nohuge(void *addr, size_t size);
void pages_boot(void);
#endif /* JEMALLOC_H_EXTERNS */