psset: Reconceptualize insertion/removal.

Really, this isn't a functional change, just a naming change.  We start thinking
of pageslabs as being always in the psset.  What we used to think of as removal
is now thought of as being in the psset, but in the process of being updated
(and therefore, unavalable for serving new allocations).

This is in preparation of subsequent changes to support deferred purging;
allocations will still be in the psset for the purposes of choosing when to
purge, but not for purposes of allocation/deallocation.
This commit is contained in:
David Goldblatt
2020-12-05 15:58:31 -08:00
committed by David Goldblatt
parent 061cabb712
commit 99fc0717e6
7 changed files with 106 additions and 71 deletions

View File

@@ -44,8 +44,13 @@ struct hpdata_s {
bool h_mid_purge;
bool h_mid_hugify;
/* Whether or not the hpdata is a the psset. */
bool h_in_psset;
/*
* Whether or not the hpdata is being updated in the psset (i.e. if
* there has been a psset_update_begin call issued without a matching
* psset_update_end call). Eventually this will expand to other types
* of updates.
*/
bool h_updating;
union {
/* When nonempty, used by the psset bins. */
@@ -123,13 +128,14 @@ hpdata_mid_hugify_get(const hpdata_t *hpdata) {
}
static inline bool
hpdata_in_psset_get(const hpdata_t *hpdata) {
return hpdata->h_in_psset;
hpdata_updating_get(const hpdata_t *hpdata) {
return hpdata->h_updating;
}
static inline void
hpdata_in_psset_set(hpdata_t *hpdata, bool in_psset) {
hpdata->h_in_psset = in_psset;
hpdata_updating_set(hpdata_t *hpdata, bool updating) {
assert(updating != hpdata->h_updating);
hpdata->h_updating = updating;
}
static inline size_t

View File

@@ -64,10 +64,14 @@ struct psset_s {
void psset_init(psset_t *psset);
void psset_stats_accum(psset_stats_t *dst, psset_stats_t *src);
void psset_insert(psset_t *psset, hpdata_t *ps);
void psset_remove(psset_t *psset, hpdata_t *ps);
/*
* Begin or end updating the given pageslab's metadata. While the pageslab is
* being updated, it won't be returned from psset_fit calls.
*/
void psset_update_begin(psset_t *psset, hpdata_t *ps);
void psset_update_end(psset_t *psset, hpdata_t *ps);
/* Analogous to the eset_fit; pick a hpdata to serve the request. */
hpdata_t *psset_fit(psset_t *psset, size_t size);
hpdata_t *psset_pick_alloc(psset_t *psset, size_t size);
#endif /* JEMALLOC_INTERNAL_PSSET_H */