Mark slab as true on sized dealloc fast path.

For sized dealloc, fastpath only handles lookup-able sizes, which must be slabs.
This commit is contained in:
Qi Wang
2021-11-30 15:58:03 -08:00
committed by Qi Wang
parent af6ee27c0d
commit 7dcf77809c
2 changed files with 17 additions and 4 deletions

View File

@@ -2946,9 +2946,17 @@ bool free_fastpath(void *ptr, size_t size, bool size_hint) {
return false;
}
alloc_ctx.szind = sz_size2index_lookup(size);
/* Max lookup class must be small. */
assert(alloc_ctx.szind < SC_NBINS);
/* This is a dead store, except when opt size checking is on. */
alloc_ctx.slab = (alloc_ctx.szind < SC_NBINS);
alloc_ctx.slab = true;
}
/*
* Currently the fastpath only handles small sizes. The branch on
* SC_LOOKUP_MAXCLASS makes sure of it. This lets us avoid checking
* tcache szind upper limit (i.e. tcache_maxclass) as well.
*/
assert(alloc_ctx.slab);
uint64_t deallocated, threshold;
te_free_fastpath_ctx(tsd, &deallocated, &threshold);