psset: Use fit/insert/remove as basis functions.

All other functionality can be implemented in terms of these; doing so (while
retaining the same API) will be convenient for subsequent refactors.
This commit is contained in:
David Goldblatt
2020-11-30 13:28:54 -08:00
committed by David Goldblatt
parent 089f8fa442
commit 5228d869ee
4 changed files with 43 additions and 144 deletions

View File

@@ -123,6 +123,11 @@ TYPED_LIST(hpdata_list, hpdata_t, ql_link)
typedef ph(hpdata_t) hpdata_age_heap_t;
ph_proto(, hpdata_age_heap_, hpdata_age_heap_t, hpdata_t);
static inline bool
hpdata_empty(hpdata_t *hpdata) {
return hpdata_nfree_get(hpdata) == HUGEPAGE_PAGES;
}
void hpdata_init(hpdata_t *hpdata, void *addr, uint64_t age);
/*
* Given an hpdata which can serve an allocation request, pick and reserve an

View File

@@ -64,13 +64,8 @@ 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);
void psset_hugify(psset_t *psset, hpdata_t *ps);
/*
* Tries to obtain a chunk from an existing pageslab already in the set.
* Returns true on failure.
*/
bool psset_alloc_reuse(psset_t *psset, edata_t *r_edata, size_t size);
/* Analogous to the eset_fit; pick a hpdata to serve the request. */
hpdata_t *psset_fit(psset_t *psset, size_t size);
/*
* Given a newly created pageslab ps (not currently in the set), pass ownership
@@ -79,6 +74,7 @@ bool psset_alloc_reuse(psset_t *psset, edata_t *r_edata, size_t size);
*/
void psset_alloc_new(psset_t *psset, hpdata_t *ps,
edata_t *r_edata, size_t size);
bool psset_alloc_reuse(psset_t *psset, edata_t *r_edata, size_t size);
/*
* Given an extent that comes from a pageslab in this pageslab set, returns it