diff --git a/include/bitcoin/database/impl/memory/mmap_body.ipp b/include/bitcoin/database/impl/memory/mmap_body.ipp index 2451290e2..5734894c3 100644 --- a/include/bitcoin/database/impl/memory/mmap_body.ipp +++ b/include/bitcoin/database/impl/memory/mmap_body.ipp @@ -263,7 +263,13 @@ void CLASS::body_run_() NOEXCEPT // Scarcity is read directly: clean cache is reclaimable, so the // kernel pressure level does not raise while free memory exhausts. + // Once current, reads are not write-ordered, so linux reclaims + // (darwin exhausts its free target without the sweep). +#if defined(HAVE_LINUX) + if (!current_.load() && (system_free() < scarce)) +#else if (system_free() < scarce) +#endif evict_next_(sweep, evicted); auto bytes = backlog(); diff --git a/include/bitcoin/database/impl/store/store.ipp b/include/bitcoin/database/impl/store/store.ipp index a0a2a1df9..e4b0bfe58 100644 --- a/include/bitcoin/database/impl/store/store.ipp +++ b/include/bitcoin/database/impl/store/store.ipp @@ -377,38 +377,66 @@ void CLASS::set_current(bool current) NOEXCEPT return; header_head_.current(current); + header_body_.current(current); input_head_.current(current); + input_body_.current(current); output_head_.current(current); + output_body_.current(current); ins_head_.current(current); + ins_body_.current(current); outs_head_.current(current); + outs_body_->current(current); tx_head_.current(current); + tx_body_.current(current); txs_head_.current(current); + txs_body_.current(current); candidate_head_.current(current); confirmed_head_.current(current); strong_head_.current(current); scan_head_.current(current); + scan_body_.current(current); scan_prefix_head_.current(current); + scan_prefix_body_.current(current); ecdsa0_head_.current(current); + ecdsa0_body_.current(current); ecdsa1_head_.current(current); + ecdsa1_body_.current(current); schnorr0_head_.current(current); + schnorr0_body_.current(current); schnorr1_head_.current(current); + schnorr1_body_.current(current); silent0_head_.current(current); + silent0_body_.current(current); silent1_head_.current(current); + silent1_body_.current(current); silent0_prefix_head_.current(current); + silent0_prefix_body_.current(current); silent1_prefix_head_.current(current); + silent1_prefix_body_.current(current); envelope_head_.current(current); duplicate_head_.current(current); + duplicate_body_.current(current); prevalid0_head_.current(current); + prevalid0_body_.current(current); prevalid1_head_.current(current); + prevalid1_body_.current(current); presilent0_head_.current(current); + presilent0_body_.current(current); presilent1_head_.current(current); + presilent1_body_.current(current); prevout_head_.current(current); + prevout_body_.current(current); state_head_.current(current); pool_head_.current(current); + pool_body_.current(current); spends_head_.current(current); + spends_body_.current(current); wtxid_head_.current(current); + wtxid_body_.current(current); filter_bk_head_.current(current); + filter_bk_body_.current(current); filter_tx_head_.current(current); + filter_tx_body_.current(current); } TEMPLATE diff --git a/include/bitcoin/database/memory/mmap.hpp b/include/bitcoin/database/memory/mmap.hpp index e5d608ff5..6f3df9688 100644 --- a/include/bitcoin/database/memory/mmap.hpp +++ b/include/bitcoin/database/memory/mmap.hpp @@ -525,7 +525,7 @@ class mmap // Set when a quiescent head settles to its file mapping (retires tracking). std::atomic_bool shared_{}; - // Set while the store reports currency (permits settle). + // Set while the store is current (permits settle, stops linux eviction). std::atomic_bool current_{}; // Set across a settle transition (head writers back off, uncounted).