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

Function tcache_create_explicit

deps/jemalloc/src/tcache.c:485–509  ·  view source on GitHub ↗

Created manual tcache for tcache.create mallctl. */

Source from the content-addressed store, hash-verified

483
484/* Created manual tcache for tcache.create mallctl. */
485tcache_t *
486tcache_create_explicit(tsd_t *tsd) {
487 tcache_t *tcache;
488 size_t size, stack_offset;
489
490 size = sizeof(tcache_t);
491 /* Naturally align the pointer stacks. */
492 size = PTR_CEILING(size);
493 stack_offset = size;
494 size += stack_nelms * sizeof(void *);
495 /* Avoid false cacheline sharing. */
496 size = sz_sa2u(size, CACHELINE);
497
498 tcache = ipallocztm(tsd_tsdn(tsd), size, CACHELINE, true, NULL, true,
499 arena_get(TSDN_NULL, 0, true));
500 if (tcache == NULL) {
501 return NULL;
502 }
503
504 tcache_init(tsd, tcache,
505 (void *)((uintptr_t)tcache + (uintptr_t)stack_offset));
506 tcache_arena_associate(tsd_tsdn(tsd), tcache, arena_ichoose(tsd, NULL));
507
508 return tcache;
509}
510
511static void
512tcache_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