MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / extent_size_quantize_ceil

Function extent_size_quantize_ceil

deps/memkind/src/jemalloc/src/extent.c:249–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247
248#ifndef JEMALLOC_JET
249static
250#endif
251size_t
252extent_size_quantize_ceil(size_t size) {
253 size_t ret;
254
255 assert(size > 0);
256 assert(size - sz_large_pad <= LARGE_MAXCLASS);
257 assert((size & PAGE_MASK) == 0);
258
259 ret = extent_size_quantize_floor(size);
260 if (ret < size) {
261 /*
262 * Skip a quantization that may have an adequately large extent,
263 * because under-sized extents may be mixed in. This only
264 * happens when an unusual size is requested, i.e. for aligned
265 * allocation, and is just one of several places where linear
266 * search would potentially find sufficiently aligned available
267 * memory somewhere lower.
268 */
269 ret = sz_pind2sz(sz_psz2ind(ret - sz_large_pad + 1)) +
270 sz_large_pad;
271 }
272 return ret;
273}
274
275/* Generate pairing heap functions. */
276ph_gen(, extent_heap_, extent_heap_t, extent_t, ph_link, extent_snad_comp)

Callers 4

extents_best_fit_lockedFunction · 0.70
extents_first_fit_lockedFunction · 0.70
extent_quantize.cFile · 0.50
TEST_BEGINFunction · 0.50

Calls 3

sz_pind2szFunction · 0.50
sz_psz2indFunction · 0.50

Tested by 1

TEST_BEGINFunction · 0.40