MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcache_event_hard

Function tcache_event_hard

app/redis-6.2.6/deps/jemalloc/src/tcache.c:39–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void
40tcache_event_hard(tsd_t *tsd, tcache_t *tcache) {
41 szind_t binind = tcache->next_gc_bin;
42
43 cache_bin_t *tbin;
44 if (binind < NBINS) {
45 tbin = tcache_small_bin_get(tcache, binind);
46 } else {
47 tbin = tcache_large_bin_get(tcache, binind);
48 }
49 if (tbin->low_water > 0) {
50 /*
51 * Flush (ceiling) 3/4 of the objects below the low water mark.
52 */
53 if (binind < NBINS) {
54 tcache_bin_flush_small(tsd, tcache, tbin, binind,
55 tbin->ncached - tbin->low_water + (tbin->low_water
56 >> 2));
57 /*
58 * Reduce fill count by 2X. Limit lg_fill_div such that
59 * the fill count is always at least 1.
60 */
61 cache_bin_info_t *tbin_info = &tcache_bin_info[binind];
62 if ((tbin_info->ncached_max >>
63 (tcache->lg_fill_div[binind] + 1)) >= 1) {
64 tcache->lg_fill_div[binind]++;
65 }
66 } else {
67 tcache_bin_flush_large(tsd, tbin, binind, tbin->ncached
68 - tbin->low_water + (tbin->low_water >> 2), tcache);
69 }
70 } else if (tbin->low_water < 0) {
71 /*
72 * Increase fill count by 2X for small bins. Make sure
73 * lg_fill_div stays greater than 0.
74 */
75 if (binind < NBINS && tcache->lg_fill_div[binind] > 1) {
76 tcache->lg_fill_div[binind]--;
77 }
78 }
79 tbin->low_water = tbin->ncached;
80
81 tcache->next_gc_bin++;
82 if (tcache->next_gc_bin == nhbins) {
83 tcache->next_gc_bin = 0;
84 }
85}
86
87void *
88tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,

Callers 1

tcache_eventFunction · 0.85

Calls 2

tcache_bin_flush_smallFunction · 0.85
tcache_bin_flush_largeFunction · 0.85

Tested by

no test coverage detected