diff options
author | Jason Evans <jasone@canonware.com> | 2016-10-12 18:49:19 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-10-12 18:55:43 (GMT) |
commit | 9acd5cf178eca9bc8a7f36a8c392b799a120bcbf (patch) | |
tree | b32689315e91e15519359ab6e53f7a9b13e8b3b0 /src | |
parent | 63b5657aa566ceab270ff6e9d4f366233d2d0b79 (diff) | |
download | jemalloc-9acd5cf178eca9bc8a7f36a8c392b799a120bcbf.zip jemalloc-9acd5cf178eca9bc8a7f36a8c392b799a120bcbf.tar.gz jemalloc-9acd5cf178eca9bc8a7f36a8c392b799a120bcbf.tar.bz2 |
Remove all vestiges of chunks.
Remove mallctls:
- opt.lg_chunk
- stats.cactive
This resolves #464.
Diffstat (limited to 'src')
-rw-r--r-- | src/arena.c | 13 | ||||
-rw-r--r-- | src/base.c | 12 | ||||
-rw-r--r-- | src/chunk.c | 51 | ||||
-rw-r--r-- | src/ctl.c | 6 | ||||
-rw-r--r-- | src/extent_dss.c | 2 | ||||
-rw-r--r-- | src/jemalloc.c | 4 | ||||
-rw-r--r-- | src/stats.c | 11 |
7 files changed, 8 insertions, 91 deletions
diff --git a/src/arena.c b/src/arena.c index 3de0237..2b8aead 100644 --- a/src/arena.c +++ b/src/arena.c @@ -229,13 +229,6 @@ static void arena_nactive_add(arena_t *arena, size_t add_pages) { - if (config_stats) { - size_t cactive_add = CHUNK_CEILING((arena->nactive + - add_pages) << LG_PAGE) - CHUNK_CEILING(arena->nactive << - LG_PAGE); - if (cactive_add != 0) - stats_cactive_add(cactive_add); - } arena->nactive += add_pages; } @@ -244,12 +237,6 @@ arena_nactive_sub(arena_t *arena, size_t sub_pages) { assert(arena->nactive >= sub_pages); - if (config_stats) { - size_t cactive_sub = CHUNK_CEILING(arena->nactive << LG_PAGE) - - CHUNK_CEILING((arena->nactive - sub_pages) << LG_PAGE); - if (cactive_sub != 0) - stats_cactive_sub(cactive_sub); - } arena->nactive -= sub_pages; } @@ -41,7 +41,7 @@ static extent_t * base_extent_alloc(tsdn_t *tsdn, size_t minsize) { extent_t *extent; - size_t csize, nsize; + size_t esize, nsize; void *addr; malloc_mutex_assert_owner(tsdn, &base_mtx); @@ -49,7 +49,7 @@ base_extent_alloc(tsdn_t *tsdn, size_t minsize) extent = base_extent_try_alloc(tsdn); /* Allocate enough space to also carve an extent out if necessary. */ nsize = (extent == NULL) ? CACHELINE_CEILING(sizeof(extent_t)) : 0; - csize = CHUNK_CEILING(minsize + nsize); + esize = PAGE_CEILING(minsize + nsize); /* * Directly call extent_alloc_mmap() because it's critical to allocate * untouched demand-zeroed virtual memory. @@ -57,24 +57,24 @@ base_extent_alloc(tsdn_t *tsdn, size_t minsize) { bool zero = true; bool commit = true; - addr = extent_alloc_mmap(NULL, csize, PAGE, &zero, &commit); + addr = extent_alloc_mmap(NULL, esize, PAGE, &zero, &commit); } if (addr == NULL) { if (extent != NULL) base_extent_dalloc(tsdn, extent); return (NULL); } - base_mapped += csize; + base_mapped += esize; if (extent == NULL) { extent = (extent_t *)addr; addr = (void *)((uintptr_t)addr + nsize); - csize -= nsize; + esize -= nsize; if (config_stats) { base_allocated += nsize; base_resident += PAGE_CEILING(nsize); } } - extent_init(extent, NULL, addr, csize, 0, true, true, true, false); + extent_init(extent, NULL, addr, esize, 0, true, true, true, false); return (extent); } diff --git a/src/chunk.c b/src/chunk.c deleted file mode 100644 index d750f71..0000000 --- a/src/chunk.c +++ /dev/null @@ -1,51 +0,0 @@ -#define JEMALLOC_CHUNK_C_ -#include "jemalloc/internal/jemalloc_internal.h" - -/******************************************************************************/ -/* Data. */ - -const char *opt_dss = DSS_DEFAULT; -size_t opt_lg_chunk = 0; - -/* Various chunk-related settings. */ -size_t chunksize; -size_t chunksize_mask; /* (chunksize - 1). */ -size_t chunk_npages; - -/******************************************************************************/ - -bool -chunk_boot(void) -{ -#ifdef _WIN32 - SYSTEM_INFO info; - GetSystemInfo(&info); - - /* - * Verify actual page size is equal to or an integral multiple of - * configured page size. - */ - if (info.dwPageSize & ((1U << LG_PAGE) - 1)) - return (true); - - /* - * Configure chunksize (if not set) to match granularity (usually 64K), - * so pages_map will always take fast path. - */ - if (!opt_lg_chunk) { - opt_lg_chunk = ffs_u((unsigned)info.dwAllocationGranularity) - - 1; - } -#else - if (!opt_lg_chunk) - opt_lg_chunk = LG_CHUNK_DEFAULT; -#endif - - /* Set variables according to the value of opt_lg_chunk. */ - chunksize = (ZU(1) << opt_lg_chunk); - assert(chunksize >= PAGE); - chunksize_mask = chunksize - 1; - chunk_npages = (chunksize >> LG_PAGE); - - return (false); -} @@ -88,7 +88,6 @@ CTL_PROTO(config_utrace) CTL_PROTO(config_xmalloc) CTL_PROTO(opt_abort) CTL_PROTO(opt_dss) -CTL_PROTO(opt_lg_chunk) CTL_PROTO(opt_narenas) CTL_PROTO(opt_decay_time) CTL_PROTO(opt_stats_print) @@ -177,7 +176,6 @@ CTL_PROTO(stats_arenas_i_nmadvise) CTL_PROTO(stats_arenas_i_purged) CTL_PROTO(stats_arenas_i_metadata) INDEX_PROTO(stats_arenas_i) -CTL_PROTO(stats_cactive) CTL_PROTO(stats_allocated) CTL_PROTO(stats_active) CTL_PROTO(stats_metadata) @@ -244,7 +242,6 @@ static const ctl_named_node_t config_node[] = { static const ctl_named_node_t opt_node[] = { {NAME("abort"), CTL(opt_abort)}, {NAME("dss"), CTL(opt_dss)}, - {NAME("lg_chunk"), CTL(opt_lg_chunk)}, {NAME("narenas"), CTL(opt_narenas)}, {NAME("decay_time"), CTL(opt_decay_time)}, {NAME("stats_print"), CTL(opt_stats_print)}, @@ -410,7 +407,6 @@ static const ctl_indexed_node_t stats_arenas_node[] = { }; static const ctl_named_node_t stats_node[] = { - {NAME("cactive"), CTL(stats_cactive)}, {NAME("allocated"), CTL(stats_allocated)}, {NAME("active"), CTL(stats_active)}, {NAME("metadata"), CTL(stats_metadata)}, @@ -1136,7 +1132,6 @@ CTL_RO_CONFIG_GEN(config_xmalloc, bool) CTL_RO_NL_GEN(opt_abort, opt_abort, bool) CTL_RO_NL_GEN(opt_dss, opt_dss, const char *) -CTL_RO_NL_GEN(opt_lg_chunk, opt_lg_chunk, size_t) CTL_RO_NL_GEN(opt_narenas, opt_narenas, unsigned) CTL_RO_NL_GEN(opt_decay_time, opt_decay_time, ssize_t) CTL_RO_NL_GEN(opt_stats_print, opt_stats_print, bool) @@ -1888,7 +1883,6 @@ CTL_RO_NL_CGEN(config_prof, lg_prof_sample, lg_prof_sample, size_t) /******************************************************************************/ -CTL_RO_CGEN(config_stats, stats_cactive, &stats_cactive, size_t *) CTL_RO_CGEN(config_stats, stats_allocated, ctl_stats.allocated, size_t) CTL_RO_CGEN(config_stats, stats_active, ctl_stats.active, size_t) CTL_RO_CGEN(config_stats, stats_metadata, ctl_stats.metadata, size_t) diff --git a/src/extent_dss.c b/src/extent_dss.c index 9c5cd25..e0e6635 100644 --- a/src/extent_dss.c +++ b/src/extent_dss.c @@ -3,6 +3,8 @@ /******************************************************************************/ /* Data. */ +const char *opt_dss = DSS_DEFAULT; + const char *dss_prec_names[] = { "disabled", "primary", diff --git a/src/jemalloc.c b/src/jemalloc.c index 580b23f..95cd054 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1024,8 +1024,6 @@ malloc_conf_init(void) } CONF_HANDLE_BOOL(opt_abort, "abort", true) - CONF_HANDLE_SIZE_T(opt_lg_chunk, "lg_chunk", LG_PAGE, - (sizeof(size_t) << 3) - 1, true) if (strncmp("dss", k, klen) == 0) { int i; bool match = false; @@ -1176,8 +1174,6 @@ malloc_init_hard_a0_locked() pages_boot(); if (base_boot()) return (true); - if (chunk_boot()) - return (true); if (extent_boot()) return (true); if (ctl_boot()) diff --git a/src/stats.c b/src/stats.c index 185ccac..ca716d5 100644 --- a/src/stats.c +++ b/src/stats.c @@ -30,8 +30,6 @@ bool opt_stats_print = false; -size_t stats_cactive = 0; - /******************************************************************************/ /* Function prototypes for non-inline static functions. */ @@ -416,7 +414,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, malloc_cprintf(write_cb, cbopaque, "Run-time option settings:\n"); OPT_WRITE_BOOL(abort) - OPT_WRITE_SIZE_T(lg_chunk) OPT_WRITE_CHAR_P(dss) OPT_WRITE_UNSIGNED(narenas) OPT_WRITE_CHAR_P(purge) @@ -486,16 +483,11 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, "Average profile dump interval: N/A\n"); } } - CTL_GET("opt.lg_chunk", &sv, size_t); - malloc_cprintf(write_cb, cbopaque, - "Chunk size: %zu (2^%zu)\n", (ZU(1) << sv), sv); } if (config_stats) { - size_t *cactive; size_t allocated, active, metadata, resident, mapped, retained; - CTL_GET("stats.cactive", &cactive, size_t *); CTL_GET("stats.allocated", &allocated, size_t); CTL_GET("stats.active", &active, size_t); CTL_GET("stats.metadata", &metadata, size_t); @@ -506,9 +498,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, "Allocated: %zu, active: %zu, metadata: %zu," " resident: %zu, mapped: %zu, retained: %zu\n", allocated, active, metadata, resident, mapped, retained); - malloc_cprintf(write_cb, cbopaque, - "Current active ceiling: %zu\n", - atomic_read_z(cactive)); if (merged) { unsigned narenas; |