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

Function arena_extent_alloc_large

deps/jemalloc/src/arena.c:427–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427extent_t *
428arena_extent_alloc_large(tsdn_t *tsdn, arena_t *arena, size_t usize,
429 size_t alignment, bool *zero) {
430 extent_hooks_t *extent_hooks = EXTENT_HOOKS_INITIALIZER;
431
432 witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
433 WITNESS_RANK_CORE, 0);
434
435 szind_t szind = sz_size2index(usize);
436 size_t mapped_add;
437 bool commit = true;
438 extent_t *extent = extents_alloc(tsdn, arena, &extent_hooks,
439 &arena->extents_dirty, NULL, usize, sz_large_pad, alignment, false,
440 szind, zero, &commit);
441 if (extent == NULL && arena_may_have_muzzy(arena)) {
442 extent = extents_alloc(tsdn, arena, &extent_hooks,
443 &arena->extents_muzzy, NULL, usize, sz_large_pad, alignment,
444 false, szind, zero, &commit);
445 }
446 size_t size = usize + sz_large_pad;
447 if (extent == NULL) {
448 extent = extent_alloc_wrapper(tsdn, arena, &extent_hooks, NULL,
449 usize, sz_large_pad, alignment, false, szind, zero,
450 &commit);
451 if (config_stats) {
452 /*
453 * extent may be NULL on OOM, but in that case
454 * mapped_add isn't used below, so there's no need to
455 * conditionlly set it to 0 here.
456 */
457 mapped_add = size;
458 }
459 } else if (config_stats) {
460 mapped_add = 0;
461 }
462
463 if (extent != NULL) {
464 if (config_stats) {
465 arena_stats_lock(tsdn, &arena->stats);
466 arena_large_malloc_stats_update(tsdn, arena, usize);
467 if (mapped_add != 0) {
468 arena_stats_add_zu(tsdn, &arena->stats,
469 &arena->stats.mapped, mapped_add);
470 }
471 arena_stats_unlock(tsdn, &arena->stats);
472 }
473 arena_nactive_add(arena, size >> LG_PAGE);
474 }
475
476 return extent;
477}
478
479void
480arena_extent_dalloc_large_prep(tsdn_t *tsdn, arena_t *arena, extent_t *extent) {

Callers 1

large_pallocFunction · 0.70

Calls 10

arena_may_have_muzzyFunction · 0.85
extents_allocFunction · 0.70
extent_alloc_wrapperFunction · 0.70
arena_nactive_addFunction · 0.70
sz_size2indexFunction · 0.50
arena_stats_lockFunction · 0.50
arena_stats_add_zuFunction · 0.50
arena_stats_unlockFunction · 0.50

Tested by

no test coverage detected