Created manual tcache for tcache.create mallctl. */
| 483 | |
| 484 | /* Created manual tcache for tcache.create mallctl. */ |
| 485 | tcache_t * |
| 486 | tcache_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 | |
| 511 | static void |
| 512 | tcache_flush_cache(tsd_t *tsd, tcache_t *tcache) { |
no test coverage detected