Skip to content

Commit 38be372

Browse files
committed
Scale dirty page thresholds by page size ratio
1 parent a419a9a commit 38be372

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/meshable_arena.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ void MeshableArena::partialScavenge() {
391391
}
392392

393393
void MeshableArena::scavenge(bool force) {
394-
if (!force && _dirtyPageCount < kMinDirtyPageThreshold) {
394+
const size_t minDirtyPageThreshold = (kMinDirtyPageThreshold * kPageSizeMin) / getPageSize();
395+
396+
if (!force && _dirtyPageCount < minDirtyPageThreshold) {
395397
return;
396398
}
397399

src/meshable_arena.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ class MeshableArena : public mesh::OneWayMmapHeap {
203203
_dirty[span.spanClass()].push_back(span);
204204
_dirtyPageCount += span.length;
205205

206-
if (_dirtyPageCount > kMaxDirtyPageThreshold) {
206+
const size_t maxDirtyPageThreshold = (kMaxDirtyPageThreshold * kPageSizeMin) / getPageSize();
207+
208+
if (_dirtyPageCount > maxDirtyPageThreshold) {
207209
// do a full scavenge with a probability 1/10
208210
if (_fastPrng.inRange(0, 9) == 9) {
209211
scavenge(true);

0 commit comments

Comments
 (0)