summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-01-03 20:40:54 (GMT)
committerJason Evans <jasone@canonware.com>2017-01-07 02:58:45 (GMT)
commitd778dd2afcc338cfd521c01382b8ed84a466aa1a (patch)
treec26f224940b6c136931d7ed984a7dfc5ce950429 /include/jemalloc
parent0f04bb1d6fc27c7fa5f6268d045c78bdc600ff65 (diff)
downloadjemalloc-d778dd2afcc338cfd521c01382b8ed84a466aa1a.zip
jemalloc-d778dd2afcc338cfd521c01382b8ed84a466aa1a.tar.gz
jemalloc-d778dd2afcc338cfd521c01382b8ed84a466aa1a.tar.bz2
Refactor ctl_stats_t.
Refactor ctl_stats_t to be a demand-zeroed non-growing data structure. To keep the size from being onerous (~60 MiB) on 32-bit systems, convert the arenas field to contain pointers rather than directly embedded ctl_arena_stats_t elements.
Diffstat (limited to 'include/jemalloc')
-rw-r--r--include/jemalloc/internal/ctl.h2
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in21
2 files changed, 15 insertions, 8 deletions
diff --git a/include/jemalloc/internal/ctl.h b/include/jemalloc/internal/ctl.h
index 4d4f304..dfb1e8e 100644
--- a/include/jemalloc/internal/ctl.h
+++ b/include/jemalloc/internal/ctl.h
@@ -61,7 +61,7 @@ struct ctl_stats_s {
size_t mapped;
size_t retained;
unsigned narenas;
- ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */
+ ctl_arena_stats_t *arenas[1 << MALLOCX_ARENA_BITS];
};
#endif /* JEMALLOC_H_STRUCTS */
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index 11a2736..991c541 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -208,11 +208,18 @@ typedef unsigned szind_t;
*
* aaaaaaaa aaaatttt tttttttt 0znnnnnn
*/
-#define MALLOCX_ARENA_MASK ((int)~0xfffff)
-#define MALLOCX_ARENA_MAX 0xffe
-#define MALLOCX_TCACHE_MASK ((int)~0xfff000ffU)
-#define MALLOCX_TCACHE_MAX 0xffd
-#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
+#define MALLOCX_ARENA_BITS 12
+#define MALLOCX_TCACHE_BITS 12
+#define MALLOCX_LG_ALIGN_BITS 6
+#define MALLOCX_ARENA_SHIFT 20
+#define MALLOCX_TCACHE_SHIFT 8
+#define MALLOCX_ARENA_MASK \
+ (((1 << MALLOCX_ARENA_BITS) - 1) << MALLOCX_ARENA_SHIFT)
+#define MALLOCX_ARENA_MAX ((1 << MALLOCX_ARENA_BITS) - 2)
+#define MALLOCX_TCACHE_MASK \
+ (((1 << MALLOCX_TCACHE_BITS) - 1) << MALLOCX_TCACHE_SHIFT)
+#define MALLOCX_TCACHE_MAX ((1 << MALLOCX_TCACHE_BITS) - 3)
+#define MALLOCX_LG_ALIGN_MASK ((1 << MALLOCX_LG_ALIGN_BITS) - 1)
/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
(ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
@@ -222,9 +229,9 @@ typedef unsigned szind_t;
((bool)(flags & MALLOCX_ZERO))
#define MALLOCX_TCACHE_GET(flags) \
- (((unsigned)((flags & MALLOCX_TCACHE_MASK) >> 8)) - 2)
+ (((unsigned)((flags & MALLOCX_TCACHE_MASK) >> MALLOCX_TCACHE_SHIFT)) - 2)
#define MALLOCX_ARENA_GET(flags) \
- (((unsigned)(((unsigned)flags) >> 20)) - 1)
+ (((unsigned)(((unsigned)flags) >> MALLOCX_ARENA_SHIFT)) - 1)
/* Smallest size class to support. */
#define TINY_MIN (1U << LG_TINY_MIN)