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

Function extent_gdump_add

deps/jemalloc/src/extent.c:743–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743static void
744extent_gdump_add(tsdn_t *tsdn, const extent_t *extent) {
745 cassert(config_prof);
746 /* prof_gdump() requirement. */
747 witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
748 WITNESS_RANK_CORE, 0);
749
750 if (opt_prof && extent_state_get(extent) == extent_state_active) {
751 size_t nadd = extent_size_get(extent) >> LG_PAGE;
752 size_t cur = atomic_fetch_add_zu(&curpages, nadd,
753 ATOMIC_RELAXED) + nadd;
754 size_t high = atomic_load_zu(&highpages, ATOMIC_RELAXED);
755 while (cur > high && !atomic_compare_exchange_weak_zu(
756 &highpages, &high, cur, ATOMIC_RELAXED, ATOMIC_RELAXED)) {
757 /*
758 * Don't refresh cur, because it may have decreased
759 * since this thread lost the highpages update race.
760 * Note that high is updated in case of CAS failure.
761 */
762 }
763 if (cur > high && prof_gdump_get_unlocked()) {
764 prof_gdump(tsdn);
765 }
766 }
767}
768
769static void
770extent_gdump_sub(tsdn_t *tsdn, const extent_t *extent) {

Callers 3

extent_register_implFunction · 0.70
extent_grow_retainedFunction · 0.70
extent_alloc_retainedFunction · 0.70

Calls 5

prof_gdumpFunction · 0.70
extent_state_getFunction · 0.50
extent_size_getFunction · 0.50
prof_gdump_get_unlockedFunction · 0.50

Tested by

no test coverage detected