Fix the bug in dalloc promoted allocations.
An allocation small enough will be promoted so that it does not share an extent with others. However, when dalloc, such allocations may not be dalloc as a promoted one if nbins < SC_NBINS. This commit fixes the bug.
This commit is contained in:
parent
630f7de952
commit
867eedfc58
@ -301,18 +301,18 @@ JEMALLOC_ALWAYS_INLINE void
|
|||||||
arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind,
|
arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind,
|
||||||
bool slow_path) {
|
bool slow_path) {
|
||||||
assert (!tsdn_null(tsdn) && tcache != NULL);
|
assert (!tsdn_null(tsdn) && tcache != NULL);
|
||||||
if (szind < TCACHE_NBINS_MAX &&
|
bool is_sample_promoted = config_prof && szind < SC_NBINS;
|
||||||
!tcache_bin_disabled(szind, &tcache->bins[szind],
|
if (unlikely(is_sample_promoted)) {
|
||||||
tcache->tcache_slow)) {
|
|
||||||
if (config_prof && unlikely(szind < SC_NBINS)) {
|
|
||||||
arena_dalloc_promoted(tsdn, ptr, tcache, slow_path);
|
arena_dalloc_promoted(tsdn, ptr, tcache, slow_path);
|
||||||
} else {
|
} else {
|
||||||
|
if (szind < tcache_nbins_get(tcache->tcache_slow) &&
|
||||||
|
!tcache_bin_disabled(szind, &tcache->bins[szind],
|
||||||
|
tcache->tcache_slow)) {
|
||||||
tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, szind,
|
tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, szind,
|
||||||
slow_path);
|
slow_path);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
edata_t *edata = emap_edata_lookup(tsdn, &arena_emap_global,
|
edata_t *edata = emap_edata_lookup(tsdn,
|
||||||
ptr);
|
&arena_emap_global, ptr);
|
||||||
if (large_dalloc_safety_checks(edata, ptr, szind)) {
|
if (large_dalloc_safety_checks(edata, ptr, szind)) {
|
||||||
/* See the comment in isfree. */
|
/* See the comment in isfree. */
|
||||||
return;
|
return;
|
||||||
@ -320,6 +320,7 @@ arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind,
|
|||||||
large_dalloc(tsdn, edata);
|
large_dalloc(tsdn, edata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the region index of a pointer. */
|
/* Find the region index of a pointer. */
|
||||||
JEMALLOC_ALWAYS_INLINE size_t
|
JEMALLOC_ALWAYS_INLINE size_t
|
||||||
|
Loading…
Reference in New Issue
Block a user