[HPA] Add pool of empty pages to hpa_central #53
+1,134
−324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
If we already have huge and empty page it may be more efficient to donate it to another hpa shard, then purge and fault it again. This also helps somewhat with virtual address space as one would get the already allocated
hpdataobject if it is available in the pool before creating another one.On some of the internal workloads we see improvement in memory, and on some we saw small CPU improvements when using pool.
What
Two commits are plain refactor - moving central related code out of the
hpa.cand moving some utility functions into a separate module. Last commit is adding simple page pool which is effectively mutex guarded two lists (purged and non-purged empty folios) that each shard can borrow from.Testing
Added some unit tests, and also tested in production using internal workloads.