* Put ps into some container so that it can be found during future allocation * requests. */
| 149 | * requests. |
| 150 | */ |
| 151 | static void |
| 152 | psset_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. */ |
| 179 | static void |
no test coverage detected