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

Function tcache_create_explicit

deps/memkind/src/jemalloc/src/tcache.c:422–446  ·  view source on GitHub ↗

Created manual tcache for tcache.create mallctl. */

Source from the content-addressed store, hash-verified

420
421/* Created manual tcache for tcache.create mallctl. */
422tcache_t *
423tcache_create_explicit(tsd_t *tsd) {
424 tcache_t *tcache;
425 size_t size, stack_offset;
426
427 size = sizeof(tcache_t);
428 /* Naturally align the pointer stacks. */
429 size = PTR_CEILING(size);
430 stack_offset = size;
431 size += stack_nelms * sizeof(void *);
432 /* Avoid false cacheline sharing. */
433 size = sz_sa2u(size, CACHELINE);
434
435 tcache = ipallocztm(tsd_tsdn(tsd), size, CACHELINE, true, NULL, true,
436 arena_get(TSDN_NULL, 0, true));
437 if (tcache == NULL) {
438 return NULL;
439 }
440
441 tcache_init(tsd, tcache,
442 (void *)((uintptr_t)tcache + (uintptr_t)stack_offset));
443 tcache_arena_associate(tsd_tsdn(tsd), tcache, arena_ichoose(tsd, NULL));
444
445 return tcache;
446}
447
448static void
449tcache_flush_cache(tsd_t *tsd, tcache_t *tcache) {

Callers 2

tcaches_createFunction · 0.70
tcaches_getFunction · 0.50

Calls 7

tcache_initFunction · 0.70
tcache_arena_associateFunction · 0.70
sz_sa2uFunction · 0.50
ipallocztmFunction · 0.50
tsd_tsdnFunction · 0.50
arena_getFunction · 0.50
arena_ichooseFunction · 0.50

Tested by

no test coverage detected