Created manual tcache for tcache.create mallctl. */
| 420 | |
| 421 | /* Created manual tcache for tcache.create mallctl. */ |
| 422 | tcache_t * |
| 423 | tcache_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 | |
| 448 | static void |
| 449 | tcache_flush_cache(tsd_t *tsd, tcache_t *tcache) { |
no test coverage detected