Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/bitcoin/database/impl/memory/mmap_staging.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,15 @@ void CLASS::settler_run_() NOEXCEPT
}
#endif

#if !defined(HAVE_APPLE)
// Scarcity is read directly: clean cache is reclaimable, so the
// kernel pressure level does not raise while free memory exhausts.
// Apple is excluded: the sweep corrects linux victim selection, and
// ubc/compressor reclaim measured competent without it (its free
// signal is also perpetually low on darwin, running the sweep hot).
if (system_free() < scarce)
evict_next_(sweep);
#endif

auto bytes = backlog();
if (is_zero(bytes))
Expand Down Expand Up @@ -998,6 +1003,7 @@ void CLASS::head_run_() NOEXCEPT
still = (top == mark) ? std::min(add1(still), idle_seconds) : zero;
mark = top;

#if !defined(HAVE_APPLE)
// Touch pass: assert working-set residency at a bounded rate.
// Hash-uniform probing is per-page sparse in every phase, so the
// kernel ages head pages cold and swaps them under cache pressure,
Expand Down Expand Up @@ -1041,6 +1047,7 @@ void CLASS::head_run_() NOEXCEPT
}
}
}
#endif // !HAVE_APPLE

if ((still < idle_seconds) || (transferred == top))
continue;
Expand Down
8 changes: 7 additions & 1 deletion include/bitcoin/database/memory/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ struct storage_settings
/// scattered: they are far too large to reside, and validation reads
/// prevouts from arbitrary earlier blocks, so read-ahead manufactures
/// cache that is never used and displaces the resident head set. Heads
/// override to random (preloaded) at construction.
/// override to random (preloaded) at construction. Apple retains normal
/// (its measured known-good): darwin fault clustering serves scattered
/// prevout reads that MADV_RANDOM would reduce to single-page faults.
#if defined(HAVE_APPLE)
advice access{ advice::normal };
#else
advice access{ advice::scattered };
#endif
};

} // namespace database
Expand Down
Loading