summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-05-13 22:20:48 (GMT)
committerJason Evans <jasone@canonware.com>2017-05-14 17:14:23 (GMT)
commit18a83681cf6fa0ab79cd0a89f8755d53931a39fb (patch)
treeeb4bfc6276e74fcfd65b38f37f733fb0daf26732 /include
parent909f0482e479c1914a1bd528bf7ade702ed6415c (diff)
downloadjemalloc-18a83681cf6fa0ab79cd0a89f8755d53931a39fb.zip
jemalloc-18a83681cf6fa0ab79cd0a89f8755d53931a39fb.tar.gz
jemalloc-18a83681cf6fa0ab79cd0a89f8755d53931a39fb.tar.bz2
Refactor (MALLOCX_ARENA_MAX + 1) to be MALLOCX_ARENA_LIMIT.
This resolves #673.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/ctl.h4
-rw-r--r--include/jemalloc/internal/extent_inlines.h4
-rw-r--r--include/jemalloc/internal/jemalloc_internal_inlines_a.h2
-rw-r--r--include/jemalloc/internal/jemalloc_internal_types.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/include/jemalloc/internal/ctl.h b/include/jemalloc/internal/ctl.h
index de74a75..23c9551 100644
--- a/include/jemalloc/internal/ctl.h
+++ b/include/jemalloc/internal/ctl.h
@@ -83,9 +83,9 @@ typedef struct ctl_arenas_s {
* Element 0 corresponds to merged stats for extant arenas (accessed via
* MALLCTL_ARENAS_ALL), element 1 corresponds to merged stats for
* destroyed arenas (accessed via MALLCTL_ARENAS_DESTROYED), and the
- * remaining MALLOCX_ARENA_MAX+1 elements correspond to arenas.
+ * remaining MALLOCX_ARENA_LIMIT elements correspond to arenas.
*/
- ctl_arena_t *arenas[MALLOCX_ARENA_MAX + 3];
+ ctl_arena_t *arenas[2 + MALLOCX_ARENA_LIMIT];
} ctl_arenas_t;
int ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
diff --git a/include/jemalloc/internal/extent_inlines.h b/include/jemalloc/internal/extent_inlines.h
index e1f8bd9..0e6311d 100644
--- a/include/jemalloc/internal/extent_inlines.h
+++ b/include/jemalloc/internal/extent_inlines.h
@@ -13,10 +13,10 @@ extent_arena_get(const extent_t *extent) {
* The following check is omitted because we should never actually read
* a NULL arena pointer.
*/
- if (false && arena_ind > MALLOCX_ARENA_MAX) {
+ if (false && arena_ind >= MALLOCX_ARENA_LIMIT) {
return NULL;
}
- assert(arena_ind <= MALLOCX_ARENA_MAX);
+ assert(arena_ind < MALLOCX_ARENA_LIMIT);
return (arena_t *)atomic_load_p(&arenas[arena_ind], ATOMIC_ACQUIRE);
}
diff --git a/include/jemalloc/internal/jemalloc_internal_inlines_a.h b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
index 1755c3a..c8e2629 100644
--- a/include/jemalloc/internal/jemalloc_internal_inlines_a.h
+++ b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
@@ -350,7 +350,7 @@ static inline arena_t *
arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing) {
arena_t *ret;
- assert(ind <= MALLOCX_ARENA_MAX);
+ assert(ind < MALLOCX_ARENA_LIMIT);
ret = (arena_t *)atomic_load_p(&arenas[ind], ATOMIC_ACQUIRE);
if (unlikely(ret == NULL)) {
diff --git a/include/jemalloc/internal/jemalloc_internal_types.h b/include/jemalloc/internal/jemalloc_internal_types.h
index 663ed8b..50f9d00 100644
--- a/include/jemalloc/internal/jemalloc_internal_types.h
+++ b/include/jemalloc/internal/jemalloc_internal_types.h
@@ -29,7 +29,7 @@ typedef int malloc_cpuid_t;
#define MALLOCX_ARENA_MASK \
(((1 << MALLOCX_ARENA_BITS) - 1) << MALLOCX_ARENA_SHIFT)
/* NB: Arena index bias decreases the maximum number of arenas by 1. */
-#define MALLOCX_ARENA_MAX ((1 << MALLOCX_ARENA_BITS) - 2)
+#define MALLOCX_ARENA_LIMIT ((1 << MALLOCX_ARENA_BITS) - 1)
#define MALLOCX_TCACHE_MASK \
(((1 << MALLOCX_TCACHE_BITS) - 1) << MALLOCX_TCACHE_SHIFT)
#define MALLOCX_TCACHE_MAX ((1 << MALLOCX_TCACHE_BITS) - 3)