summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-05-27 05:12:38 (GMT)
committerJason Evans <jasone@canonware.com>2016-06-03 19:27:41 (GMT)
commit4731cd47f7168e70809d83c8569f501891ecffa1 (patch)
tree9edafb3159339ab08c783138c2d4d4fc863aef0d /include
parent741967e79d10c94005b0f4065586c1b488a21fde (diff)
downloadjemalloc-4731cd47f7168e70809d83c8569f501891ecffa1.zip
jemalloc-4731cd47f7168e70809d83c8569f501891ecffa1.tar.gz
jemalloc-4731cd47f7168e70809d83c8569f501891ecffa1.tar.bz2
Allow chunks to not be naturally aligned.
Precisely size extents for huge size classes that aren't multiples of chunksize.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/arena.h2
-rw-r--r--include/jemalloc/internal/extent.h16
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in22
-rw-r--r--include/jemalloc/internal/private_symbols.txt3
4 files changed, 26 insertions, 17 deletions
diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h
index fac6fd3..c298df9 100644
--- a/include/jemalloc/internal/arena.h
+++ b/include/jemalloc/internal/arena.h
@@ -486,8 +486,6 @@ void arena_chunk_cache_maybe_remove(arena_t *arena, extent_t *extent,
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, extent_t *extent);
-void arena_chunk_ralloc_huge_similar(tsdn_t *tsdn, arena_t *arena,
- extent_t *extent, size_t oldsize);
void arena_chunk_ralloc_huge_shrink(tsdn_t *tsdn, arena_t *arena,
extent_t *extent, size_t oldsize);
void arena_chunk_ralloc_huge_expand(tsdn_t *tsdn, arena_t *arena,
diff --git a/include/jemalloc/internal/extent.h b/include/jemalloc/internal/extent.h
index c3bdacb..919b74f 100644
--- a/include/jemalloc/internal/extent.h
+++ b/include/jemalloc/internal/extent.h
@@ -90,6 +90,8 @@ ph_proto(, extent_heap_, extent_heap_t, extent_t)
arena_t *extent_arena_get(const extent_t *extent);
void *extent_addr_get(const extent_t *extent);
size_t extent_size_get(const extent_t *extent);
+void *extent_before_get(const extent_t *extent);
+void *extent_last_get(const extent_t *extent);
void *extent_past_get(const extent_t *extent);
bool extent_active_get(const extent_t *extent);
bool extent_dirty_get(const extent_t *extent);
@@ -138,6 +140,20 @@ extent_size_get(const extent_t *extent)
}
JEMALLOC_INLINE void *
+extent_before_get(const extent_t *extent)
+{
+
+ return ((void *)(uintptr_t)extent->e_addr - PAGE);
+}
+
+JEMALLOC_INLINE void *
+extent_last_get(const extent_t *extent)
+{
+
+ return ((void *)(uintptr_t)extent->e_addr + extent->e_size - PAGE);
+}
+
+JEMALLOC_INLINE void *
extent_past_get(const extent_t *extent)
{
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index 7afe569..ef4e052 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -797,14 +797,14 @@ sa2u(size_t size, size_t alignment)
return (usize);
}
- /* Try for a large size class. */
- if (likely(size <= large_maxclass) && likely(alignment < chunksize)) {
- /*
- * We can't achieve subpage alignment, so round up alignment
- * to the minimum that can actually be supported.
- */
- alignment = PAGE_CEILING(alignment);
+ /*
+ * We can't achieve subpage alignment, so round up alignment to the
+ * minimum that can actually be supported.
+ */
+ alignment = PAGE_CEILING(alignment);
+ /* Try for a large size class. */
+ if (likely(size <= large_maxclass) && likely(alignment == PAGE)) {
/* Make sure result is a large size class. */
usize = (size <= LARGE_MINCLASS) ? LARGE_MINCLASS : s2u(size);
@@ -821,12 +821,6 @@ sa2u(size_t size, size_t alignment)
if (unlikely(alignment > HUGE_MAXCLASS))
return (0);
- /*
- * We can't achieve subchunk alignment, so round up alignment to the
- * minimum that can actually be supported.
- */
- alignment = CHUNK_CEILING(alignment);
-
/* Make sure result is a huge size class. */
if (size <= chunksize)
usize = chunksize;
@@ -839,7 +833,7 @@ sa2u(size_t size, size_t alignment)
}
/*
- * Calculate the multi-chunk mapping that huge_palloc() would need in
+ * Calculate the multi-page mapping that huge_palloc() would need in
* order to guarantee the alignment.
*/
if (usize + alignment < usize) {
diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt
index c446601..44a2cd3 100644
--- a/include/jemalloc/internal/private_symbols.txt
+++ b/include/jemalloc/internal/private_symbols.txt
@@ -19,7 +19,6 @@ arena_chunk_cache_maybe_remove
arena_chunk_dalloc_huge
arena_chunk_ralloc_huge_expand
arena_chunk_ralloc_huge_shrink
-arena_chunk_ralloc_huge_similar
arena_cleanup
arena_dalloc
arena_dalloc_bin
@@ -211,6 +210,7 @@ extent_addr_set
extent_alloc
extent_arena_get
extent_arena_set
+extent_before_get
extent_committed_get
extent_committed_set
extent_dalloc
@@ -219,6 +219,7 @@ extent_dirty_insert
extent_dirty_remove
extent_dirty_set
extent_init
+extent_last_get
extent_past_get
extent_prof_tctx_get
extent_prof_tctx_set