summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-05-19 04:02:46 (GMT)
committerJason Evans <jasone@canonware.com>2016-06-03 19:27:41 (GMT)
commitde0305a7f3e443d48e012272e1b91c44d2b129d2 (patch)
treeba82031992078ee5dab5572bab15aeb8b31f56e3 /include
parent1ad060584f8ae4e0b9bc30c89ad7c1860ac3d89d (diff)
downloadjemalloc-de0305a7f3e443d48e012272e1b91c44d2b129d2.zip
jemalloc-de0305a7f3e443d48e012272e1b91c44d2b129d2.tar.gz
jemalloc-de0305a7f3e443d48e012272e1b91c44d2b129d2.tar.bz2
Add/use chunk_split_wrapper().
Remove redundant ptr/oldsize args from huge_*(). Refactor huge/chunk/arena code boundaries.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/arena.h38
-rw-r--r--include/jemalloc/internal/chunk.h8
-rw-r--r--include/jemalloc/internal/huge.h21
-rw-r--r--include/jemalloc/internal/private_symbols.txt3
4 files changed, 35 insertions, 35 deletions
diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h
index 68d1015..187b625 100644
--- a/include/jemalloc/internal/arena.h
+++ b/include/jemalloc/internal/arena.h
@@ -177,13 +177,6 @@ typedef ph(arena_chunk_map_misc_t) arena_run_heap_t;
/* Arena chunk header. */
struct arena_chunk_s {
/*
- * A pointer to the arena that owns the chunk is stored within the
- * extent structure. This field as a whole is used by chunks_rtree to
- * support both ivsalloc() and core-based debugging.
- */
- extent_t extent;
-
- /*
* Map of pages within chunk that keeps track of free/large/small. The
* first map_bias entries are omitted, since the chunk header does not
* need to be tracked in the map. This omission saves a header page
@@ -315,7 +308,7 @@ struct arena_s {
* order to avoid interactions between multiple threads that could make
* a single spare inadequate.
*/
- arena_chunk_t *spare;
+ extent_t *spare;
/* Minimum ratio (log base 2) of nactive:ndirty. */
ssize_t lg_dirty_mult;
@@ -481,22 +474,27 @@ typedef size_t (run_quantize_t)(size_t);
extern run_quantize_t *run_quantize_floor;
extern run_quantize_t *run_quantize_ceil;
#endif
+extent_t *arena_chunk_cache_alloc(tsdn_t *tsdn, arena_t *arena,
+ chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
+ bool *zero);
+void arena_chunk_cache_dalloc(tsdn_t *tsdn, arena_t *arena,
+ chunk_hooks_t *chunk_hooks, void *chunk, size_t size, bool committed);
void arena_chunk_cache_maybe_insert(arena_t *arena, extent_t *extent,
bool cache);
void arena_chunk_cache_maybe_remove(arena_t *arena, extent_t *extent,
bool cache);
extent_t *arena_extent_alloc(tsdn_t *tsdn, arena_t *arena);
void arena_extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
-void *arena_chunk_alloc_huge(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool *zero);
+extent_t *arena_chunk_alloc_huge(tsdn_t *tsdn, arena_t *arena,
+ size_t usize, size_t alignment, bool *zero);
void arena_chunk_dalloc_huge(tsdn_t *tsdn, arena_t *arena, void *chunk,
size_t usize);
void arena_chunk_ralloc_huge_similar(tsdn_t *tsdn, arena_t *arena,
- void *chunk, size_t oldsize, size_t usize);
+ extent_t *extent, size_t oldsize);
void arena_chunk_ralloc_huge_shrink(tsdn_t *tsdn, arena_t *arena,
- void *chunk, size_t oldsize, size_t usize);
-bool arena_chunk_ralloc_huge_expand(tsdn_t *tsdn, arena_t *arena,
- extent_t *extent, size_t usize);
+ extent_t *extent, size_t oldsize);
+void arena_chunk_ralloc_huge_expand(tsdn_t *tsdn, arena_t *arena,
+ extent_t *extent, size_t oldsize);
ssize_t arena_lg_dirty_mult_get(tsdn_t *tsdn, arena_t *arena);
bool arena_lg_dirty_mult_set(tsdn_t *tsdn, arena_t *arena,
ssize_t lg_dirty_mult);
@@ -1193,7 +1191,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr)
ret = atomic_read_p(&elm->prof_tctx_pun);
}
} else
- ret = huge_prof_tctx_get(tsdn, extent, ptr);
+ ret = huge_prof_tctx_get(tsdn, extent);
return (ret);
}
@@ -1230,7 +1228,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr,
assert(arena_mapbits_large_get(chunk, pageind) == 0);
}
} else
- huge_prof_tctx_set(tsdn, extent, ptr, tctx);
+ huge_prof_tctx_set(tsdn, extent, tctx);
}
JEMALLOC_INLINE void
@@ -1258,7 +1256,7 @@ arena_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr,
atomic_write_p(&elm->prof_tctx_pun,
(prof_tctx_t *)(uintptr_t)1U);
} else
- huge_prof_tctx_reset(tsdn, extent, ptr);
+ huge_prof_tctx_reset(tsdn, extent);
}
}
@@ -1362,7 +1360,7 @@ arena_salloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr, bool demote)
ret = index2size(binind);
}
} else
- ret = huge_salloc(tsdn, extent, ptr);
+ ret = huge_salloc(tsdn, extent);
return (ret);
}
@@ -1413,7 +1411,7 @@ arena_dalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache,
}
}
} else
- huge_dalloc(tsdn, extent, ptr);
+ huge_dalloc(tsdn, extent);
}
JEMALLOC_ALWAYS_INLINE void
@@ -1470,7 +1468,7 @@ arena_sdalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size,
}
}
} else
- huge_dalloc(tsdn, extent, ptr);
+ huge_dalloc(tsdn, extent);
}
# endif /* JEMALLOC_ARENA_INLINE_B */
#endif
diff --git a/include/jemalloc/internal/chunk.h b/include/jemalloc/internal/chunk.h
index 9634975..78cc4c2 100644
--- a/include/jemalloc/internal/chunk.h
+++ b/include/jemalloc/internal/chunk.h
@@ -55,10 +55,10 @@ chunk_hooks_t chunk_hooks_set(tsdn_t *tsdn, arena_t *arena,
bool chunk_register(tsdn_t *tsdn, const extent_t *extent);
void chunk_deregister(tsdn_t *tsdn, const extent_t *extent);
void chunk_reregister(tsdn_t *tsdn, const extent_t *extent);
-void *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena,
+extent_t *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
- bool *zero, bool dalloc_extent);
-void *chunk_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
+ bool *zero);
+extent_t *chunk_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
bool *zero, bool *commit);
void chunk_dalloc_cache(tsdn_t *tsdn, arena_t *arena,
@@ -75,6 +75,8 @@ bool chunk_decommit_wrapper(tsdn_t *tsdn, arena_t *arena,
bool chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t offset,
size_t length);
+extent_t *chunk_split_wrapper(tsdn_t *tsdn, arena_t *arena,
+ chunk_hooks_t *chunk_hooks, extent_t *extent, size_t size_a, size_t size_b);
bool chunk_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, extent_t *a, extent_t *b);
bool chunk_boot(void);
diff --git a/include/jemalloc/internal/huge.h b/include/jemalloc/internal/huge.h
index a385a20..bdc8f84 100644
--- a/include/jemalloc/internal/huge.h
+++ b/include/jemalloc/internal/huge.h
@@ -12,22 +12,19 @@
void *huge_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero);
void *huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize,
size_t alignment, bool zero);
-bool huge_ralloc_no_move(tsdn_t *tsdn, extent_t *extent, void *ptr,
- size_t oldsize, size_t usize_min, size_t usize_max, bool zero);
-void *huge_ralloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent, void *ptr,
- size_t oldsize, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache);
+bool huge_ralloc_no_move(tsdn_t *tsdn, extent_t *extent, size_t usize_min,
+ size_t usize_max, bool zero);
+void *huge_ralloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
+ size_t usize, size_t alignment, bool zero, tcache_t *tcache);
#ifdef JEMALLOC_JET
typedef void (huge_dalloc_junk_t)(tsdn_t *, void *, size_t);
extern huge_dalloc_junk_t *huge_dalloc_junk;
#endif
-void huge_dalloc(tsdn_t *tsdn, extent_t *extent, void *ptr);
-size_t huge_salloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr);
-prof_tctx_t *huge_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent,
- const void *ptr);
-void huge_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr,
- prof_tctx_t *tctx);
-void huge_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr);
+void huge_dalloc(tsdn_t *tsdn, extent_t *extent);
+size_t huge_salloc(tsdn_t *tsdn, const extent_t *extent);
+prof_tctx_t *huge_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent);
+void huge_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, prof_tctx_t *tctx);
+void huge_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent);
#endif /* JEMALLOC_H_EXTERNS */
/******************************************************************************/
diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt
index 9b507b1..34a6816 100644
--- a/include/jemalloc/internal/private_symbols.txt
+++ b/include/jemalloc/internal/private_symbols.txt
@@ -12,6 +12,8 @@ arena_choose
arena_choose_hard
arena_choose_impl
arena_chunk_alloc_huge
+arena_chunk_cache_alloc
+arena_chunk_cache_dalloc
arena_chunk_cache_maybe_insert
arena_chunk_cache_maybe_remove
arena_chunk_dalloc_huge
@@ -184,6 +186,7 @@ chunk_prefork
chunk_purge_wrapper
chunk_register
chunk_reregister
+chunk_split_wrapper
chunks_rtree
chunksize
chunksize_mask