HPA: Use a whole-shard purging heuristic.

Previously, we used only hpdata-local information to decide whether to purge.
This commit is contained in:
David Goldblatt
2020-12-06 13:48:46 -08:00
committed by David Goldblatt
parent dc886e5608
commit 56e85c0e47
4 changed files with 86 additions and 34 deletions

View File

@@ -93,6 +93,12 @@ struct hpa_shard_s {
unsigned ind;
emap_t *emap;
/*
* How many pages have we started but not yet finished purging in this
* hpa shard.
*/
size_t npending_purge;
/*
* Those stats which are copied directly into the CTL-centric hpa shard
* stats.

View File

@@ -171,6 +171,7 @@ hpdata_purge_allowed_get(const hpdata_t *hpdata) {
static inline void
hpdata_purge_allowed_set(hpdata_t *hpdata, bool purge_allowed) {
assert(purge_allowed == false || !hpdata->h_mid_purge);
hpdata->h_purge_allowed = purge_allowed;
}
@@ -192,6 +193,7 @@ hpdata_hugify_allowed_get(const hpdata_t *hpdata) {
static inline void
hpdata_hugify_allowed_set(hpdata_t *hpdata, bool hugify_allowed) {
assert(hugify_allowed == false || !hpdata->h_mid_hugify);
hpdata->h_hugify_allowed = hugify_allowed;
}
@@ -313,6 +315,18 @@ hpdata_consistent(hpdata_t *hpdata) {
if (hpdata->h_huge && hpdata->h_ntouched != HUGEPAGE_PAGES) {
return false;
}
if (hpdata_changing_state_get(hpdata)
&& (hpdata->h_purge_allowed || hpdata->h_hugify_allowed)) {
return false;
}
if (hpdata_purge_allowed_get(hpdata)
!= hpdata_in_psset_purge_container_get(hpdata)) {
return false;
}
if (hpdata_hugify_allowed_get(hpdata)
!= hpdata_in_psset_hugify_container_get(hpdata)) {
return false;
}
return true;
}