MCPcopy Create free account
hub / github.com/beefytech/Beef / psset_alloc_container_insert

Function psset_alloc_container_insert

BeefRT/JEMalloc/src/psset.c:151–176  ·  view source on GitHub ↗

* Put ps into some container so that it can be found during future allocation * requests. */

Source from the content-addressed store, hash-verified

149 * requests.
150 */
151static void
152psset_alloc_container_insert(psset_t *psset, hpdata_t *ps) {
153 assert(!hpdata_in_psset_alloc_container_get(ps));
154 hpdata_in_psset_alloc_container_set(ps, true);
155 if (hpdata_empty(ps)) {
156 /*
157 * This prepend, paired with popping the head in psset_fit,
158 * means we implement LIFO ordering for the empty slabs set,
159 * which seems reasonable.
160 */
161 hpdata_empty_list_prepend(&psset->empty, ps);
162 } else if (hpdata_full(ps)) {
163 /*
164 * We don't need to keep track of the full slabs; we're never
165 * going to return them from a psset_pick_alloc call.
166 */
167 } else {
168 size_t longest_free_range = hpdata_longest_free_range_get(ps);
169
170 pszind_t pind = sz_psz2ind(sz_psz_quantize_floor(
171 longest_free_range << LG_PAGE));
172 assert(pind < PSSET_NPSIZES);
173
174 psset_hpdata_heap_insert(psset, pind, ps);
175 }
176}
177
178/* Remove ps from those collections. */
179static void

Callers 2

psset_update_endFunction · 0.85
psset_insertFunction · 0.85

Calls 8

hpdata_emptyFunction · 0.85
hpdata_fullFunction · 0.85
sz_psz2indFunction · 0.85
sz_psz_quantize_floorFunction · 0.85
psset_hpdata_heap_insertFunction · 0.85

Tested by

no test coverage detected