Tidy up extent quantization.
Remove obsolete unit test scaffolding for extent quantization. Remove redundant assertions. Add an assertion to extents_first_best_fit_locked() that should help prevent aligned allocation regressions.
This commit is contained in:
parent
d727596bcb
commit
079b8bee37
@ -11,10 +11,6 @@ extent_hooks_t *extent_hooks_get(arena_t *arena);
|
|||||||
extent_hooks_t *extent_hooks_set(arena_t *arena, extent_hooks_t *extent_hooks);
|
extent_hooks_t *extent_hooks_set(arena_t *arena, extent_hooks_t *extent_hooks);
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
typedef size_t (extent_size_quantize_t)(size_t);
|
|
||||||
extern extent_size_quantize_t *extent_size_quantize_floor;
|
|
||||||
extern extent_size_quantize_t *extent_size_quantize_ceil;
|
|
||||||
#else
|
|
||||||
size_t extent_size_quantize_floor(size_t size);
|
size_t extent_size_quantize_floor(size_t size);
|
||||||
size_t extent_size_quantize_ceil(size_t size);
|
size_t extent_size_quantize_ceil(size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
26
src/extent.c
26
src/extent.c
@ -118,9 +118,8 @@ extent_hooks_assure_initialized(arena_t *arena,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifndef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_floor
|
static
|
||||||
#define extent_size_quantize_floor JEMALLOC_N(n_extent_size_quantize_floor)
|
|
||||||
#endif
|
#endif
|
||||||
size_t
|
size_t
|
||||||
extent_size_quantize_floor(size_t size) {
|
extent_size_quantize_floor(size_t size) {
|
||||||
@ -130,9 +129,6 @@ extent_size_quantize_floor(size_t size) {
|
|||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
assert((size & PAGE_MASK) == 0);
|
assert((size & PAGE_MASK) == 0);
|
||||||
|
|
||||||
assert(size != 0);
|
|
||||||
assert(size == PAGE_CEILING(size));
|
|
||||||
|
|
||||||
pind = psz2ind(size - large_pad + 1);
|
pind = psz2ind(size - large_pad + 1);
|
||||||
if (pind == 0) {
|
if (pind == 0) {
|
||||||
/*
|
/*
|
||||||
@ -147,16 +143,9 @@ extent_size_quantize_floor(size_t size) {
|
|||||||
assert(ret <= size);
|
assert(ret <= size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
|
||||||
#undef extent_size_quantize_floor
|
|
||||||
#define extent_size_quantize_floor JEMALLOC_N(extent_size_quantize_floor)
|
|
||||||
extent_size_quantize_t *extent_size_quantize_floor =
|
|
||||||
JEMALLOC_N(n_extent_size_quantize_floor);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifndef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_ceil
|
static
|
||||||
#define extent_size_quantize_ceil JEMALLOC_N(n_extent_size_quantize_ceil)
|
|
||||||
#endif
|
#endif
|
||||||
size_t
|
size_t
|
||||||
extent_size_quantize_ceil(size_t size) {
|
extent_size_quantize_ceil(size_t size) {
|
||||||
@ -180,12 +169,6 @@ extent_size_quantize_ceil(size_t size) {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
|
||||||
#undef extent_size_quantize_ceil
|
|
||||||
#define extent_size_quantize_ceil JEMALLOC_N(extent_size_quantize_ceil)
|
|
||||||
extent_size_quantize_t *extent_size_quantize_ceil =
|
|
||||||
JEMALLOC_N(n_extent_size_quantize_ceil);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Generate pairing heap functions. */
|
/* Generate pairing heap functions. */
|
||||||
ph_gen(, extent_heap_, extent_heap_t, extent_t, ph_link, extent_snad_comp)
|
ph_gen(, extent_heap_, extent_heap_t, extent_t, ph_link, extent_snad_comp)
|
||||||
@ -258,6 +241,7 @@ extents_first_best_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents,
|
|||||||
for (pszind_t i = pind; i < NPSIZES+1; i++) {
|
for (pszind_t i = pind; i < NPSIZES+1; i++) {
|
||||||
extent_t *extent = extent_heap_first(&extents->heaps[i]);
|
extent_t *extent = extent_heap_first(&extents->heaps[i]);
|
||||||
if (extent != NULL) {
|
if (extent != NULL) {
|
||||||
|
assert(extent_size_get(extent) >= size);
|
||||||
return extent;
|
return extent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user