Replace extent_achunk_[gs]et() with extent_slab_[gs]et().

This commit is contained in:
Jason Evans
2016-04-07 10:24:14 -04:00
parent fae8344098
commit d78846c989
8 changed files with 33 additions and 33 deletions

View File

@@ -1185,7 +1185,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr)
cassert(config_prof);
assert(ptr != NULL);
if (likely(extent_achunk_get(extent))) {
if (likely(extent_slab_get(extent))) {
arena_chunk_t *chunk = (arena_chunk_t *)extent_addr_get(extent);
size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
size_t mapbits = arena_mapbits_get(chunk, pageind);
@@ -1211,7 +1211,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr,
cassert(config_prof);
assert(ptr != NULL);
if (likely(extent_achunk_get(extent))) {
if (likely(extent_slab_get(extent))) {
arena_chunk_t *chunk = (arena_chunk_t *)extent_addr_get(extent);
size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
@@ -1331,7 +1331,7 @@ arena_salloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr, bool demote)
assert(ptr != NULL);
if (likely(extent_achunk_get(extent))) {
if (likely(extent_slab_get(extent))) {
const arena_chunk_t *chunk =
(const arena_chunk_t *)extent_addr_get(extent);
@@ -1381,7 +1381,7 @@ arena_dalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache,
assert(!tsdn_null(tsdn) || tcache == NULL);
assert(ptr != NULL);
if (likely(extent_achunk_get(extent))) {
if (likely(extent_slab_get(extent))) {
arena_chunk_t *chunk = (arena_chunk_t *)extent_addr_get(extent);
pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
@@ -1428,7 +1428,7 @@ arena_sdalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size,
assert(!tsdn_null(tsdn) || tcache == NULL);
if (likely(extent_achunk_get(extent))) {
if (likely(extent_slab_get(extent))) {
arena_chunk_t *chunk = (arena_chunk_t *)extent_addr_get(extent);
if (config_prof && opt_prof) {

View File

@@ -35,10 +35,11 @@ struct extent_s {
bool e_committed;
/*
* The achunk flag is used to validate that huge allocation lookups
* don't return arena chunks.
* The slab flag indicates whether the extent is used for a slab of
* small regions. This helps differentiate small size classes, and it
* indicates whether interior pointers can be looked up via iealloc().
*/
bool e_achunk;
bool e_slab;
/* Profile counters, used for huge objects. */
prof_tctx_t *e_prof_tctx;
@@ -79,7 +80,7 @@ size_t extent_size_get(const extent_t *extent);
bool extent_active_get(const extent_t *extent);
bool extent_zeroed_get(const extent_t *extent);
bool extent_committed_get(const extent_t *extent);
bool extent_achunk_get(const extent_t *extent);
bool extent_slab_get(const extent_t *extent);
prof_tctx_t *extent_prof_tctx_get(const extent_t *extent);
void extent_arena_set(extent_t *extent, arena_t *arena);
void extent_addr_set(extent_t *extent, void *addr);
@@ -87,10 +88,10 @@ void extent_size_set(extent_t *extent, size_t size);
void extent_active_set(extent_t *extent, bool active);
void extent_zeroed_set(extent_t *extent, bool zeroed);
void extent_committed_set(extent_t *extent, bool committed);
void extent_achunk_set(extent_t *extent, bool achunk);
void extent_slab_set(extent_t *extent, bool slab);
void extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx);
void extent_init(extent_t *extent, arena_t *arena, void *addr,
size_t size, bool active, bool zeroed, bool committed);
size_t size, bool active, bool zeroed, bool committed, bool slab);
void extent_dirty_insert(extent_t *extent,
arena_runs_dirty_link_t *runs_dirty, extent_t *chunks_dirty);
void extent_dirty_remove(extent_t *extent);
@@ -136,15 +137,15 @@ JEMALLOC_INLINE bool
extent_committed_get(const extent_t *extent)
{
assert(!extent->e_achunk);
assert(!extent->e_slab);
return (extent->e_committed);
}
JEMALLOC_INLINE bool
extent_achunk_get(const extent_t *extent)
extent_slab_get(const extent_t *extent)
{
return (extent->e_achunk);
return (extent->e_slab);
}
JEMALLOC_INLINE prof_tctx_t *
@@ -197,10 +198,10 @@ extent_committed_set(extent_t *extent, bool committed)
}
JEMALLOC_INLINE void
extent_achunk_set(extent_t *extent, bool achunk)
extent_slab_set(extent_t *extent, bool slab)
{
extent->e_achunk = achunk;
extent->e_slab = slab;
}
JEMALLOC_INLINE void
@@ -212,7 +213,7 @@ extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx)
JEMALLOC_INLINE void
extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
bool active, bool zeroed, bool committed)
bool active, bool zeroed, bool committed, bool slab)
{
extent_arena_set(extent, arena);
@@ -221,7 +222,7 @@ extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
extent_active_set(extent, active);
extent_zeroed_set(extent, zeroed);
extent_committed_set(extent, committed);
extent_achunk_set(extent, false);
extent_slab_set(extent, slab);
if (config_prof)
extent_prof_tctx_set(extent, NULL);
qr_new(&extent->rd, rd_link);

View File

@@ -1095,8 +1095,7 @@ ivsalloc(tsdn_t *tsdn, const void *ptr, bool demote)
return (0);
assert(extent_active_get(extent));
/* Only arena chunks should be looked up via interior pointers. */
assert(extent_addr_get(extent) == ptr ||
extent_achunk_get(extent));
assert(extent_addr_get(extent) == ptr || extent_slab_get(extent));
return (isalloc(tsdn, extent, ptr, demote));
}

View File

@@ -205,8 +205,6 @@ ctl_postfork_parent
ctl_prefork
decay_ticker_get
dss_prec_names
extent_achunk_get
extent_achunk_set
extent_active_get
extent_active_set
extent_addr_get
@@ -222,6 +220,8 @@ extent_prof_tctx_get
extent_prof_tctx_set
extent_size_get
extent_size_set
extent_slab_get
extent_slab_set
extent_tree_ad_destroy
extent_tree_ad_destroy_recurse
extent_tree_ad_empty