From 1799cfa88a1d2ce2afa0dbbc4517626c1fe24f10 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 1 Apr 2020 12:01:11 +0300 Subject: [PATCH] logalloc: use namespace-scope seastar::idle_cpu_handler and related rather than reactor scope This allows us to drop a #include , reducing compile time. Several translation units that lost access to required declarations are updated with the required includes (this can be an include of reactor.hh itself, in case the translation unit that lost it got it indirectly via logalloc.hh) Ref #1. --- db/hints/resource_manager.cc | 1 + flat_mutation_reader.hh | 1 + locator/ec2_snitch.cc | 1 + locator/gce_snitch.cc | 1 + test/perf/perf_mutation.cc | 1 + test/perf/perf_row_cache_update.cc | 1 + utils/logalloc.cc | 14 +++++++------- utils/logalloc.hh | 6 ++++-- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/db/hints/resource_manager.cc b/db/hints/resource_manager.cc index e8d501db0e..4932358d3e 100644 --- a/db/hints/resource_manager.cc +++ b/db/hints/resource_manager.cc @@ -27,6 +27,7 @@ #include "utils/disk-error-handler.hh" #include "seastarx.hh" #include +#include namespace db { namespace hints { diff --git a/flat_mutation_reader.hh b/flat_mutation_reader.hh index 331b84937b..95945e3045 100644 --- a/flat_mutation_reader.hh +++ b/flat_mutation_reader.hh @@ -31,6 +31,7 @@ #include #include +#include #include "db/timeout_clock.hh" #include diff --git a/locator/ec2_snitch.cc b/locator/ec2_snitch.cc index 7a591d57b9..24dd4740d0 100644 --- a/locator/ec2_snitch.cc +++ b/locator/ec2_snitch.cc @@ -1,4 +1,5 @@ #include "locator/ec2_snitch.hh" +#include namespace locator { diff --git a/locator/gce_snitch.cc b/locator/gce_snitch.cc index 24f0f20a5a..fdb2d59f08 100644 --- a/locator/gce_snitch.cc +++ b/locator/gce_snitch.cc @@ -39,6 +39,7 @@ */ #include +#include #include "locator/gce_snitch.hh" namespace locator { diff --git a/test/perf/perf_mutation.cc b/test/perf/perf_mutation.cc index a1644253a3..8bf46249a4 100644 --- a/test/perf/perf_mutation.cc +++ b/test/perf/perf_mutation.cc @@ -23,6 +23,7 @@ #include "database.hh" #include "test/perf/perf.hh" #include +#include static atomic_cell make_atomic_cell(data_type dt, bytes value) { return atomic_cell::make_live(*dt, 0, value); diff --git a/test/perf/perf_row_cache_update.cc b/test/perf/perf_row_cache_update.cc index ab8cfeb471..181ce67304 100644 --- a/test/perf/perf_row_cache_update.cc +++ b/test/perf/perf_row_cache_update.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include "utils/managed_bytes.hh" #include "utils/extremum_tracking.hh" diff --git a/utils/logalloc.cc b/utils/logalloc.cc index 21a9dfbedc..21072bf86f 100644 --- a/utils/logalloc.cc +++ b/utils/logalloc.cc @@ -381,7 +381,7 @@ public: void register_region(region::impl*); void unregister_region(region::impl*) noexcept; size_t reclaim(size_t bytes); - reactor::idle_cpu_handler_result compact_on_idle(reactor::work_waiting_on_reactor check_for_work); + idle_cpu_handler_result compact_on_idle(work_waiting_on_reactor check_for_work); // Releases whole segments back to the segment pool. // After the call, if there is enough evictable memory, the amount of free segments in the pool // will be at least reserve_segments + div_ceil(bytes, segment::size). @@ -418,7 +418,7 @@ size_t tracker::reclaim(size_t bytes) { return _impl->reclaim(bytes); } -reactor::idle_cpu_handler_result tracker::compact_on_idle(reactor::work_waiting_on_reactor check_for_work) { +idle_cpu_handler_result tracker::compact_on_idle(work_waiting_on_reactor check_for_work) { return _impl->compact_on_idle(check_for_work); } @@ -1875,13 +1875,13 @@ struct reclaim_timer { } }; -reactor::idle_cpu_handler_result tracker::impl::compact_on_idle(reactor::work_waiting_on_reactor check_for_work) { +idle_cpu_handler_result tracker::impl::compact_on_idle(work_waiting_on_reactor check_for_work) { if (!_reclaiming_enabled) { - return reactor::idle_cpu_handler_result::no_more_work; + return idle_cpu_handler_result::no_more_work; } reclaiming_lock rl(*this); if (_regions.empty()) { - return reactor::idle_cpu_handler_result::no_more_work; + return idle_cpu_handler_result::no_more_work; } segment_pool::reservation_goal open_emergency_pool(shard_segment_pool, 0); @@ -1899,14 +1899,14 @@ reactor::idle_cpu_handler_result tracker::impl::compact_on_idle(reactor::work_wa region::impl* r = _regions.back(); if (!r->is_idle_compactible()) { - return reactor::idle_cpu_handler_result::no_more_work; + return idle_cpu_handler_result::no_more_work; } r->compact(); boost::range::push_heap(_regions, cmp); } - return reactor::idle_cpu_handler_result::interrupted_by_higher_priority_task; + return idle_cpu_handler_result::interrupted_by_higher_priority_task; } size_t tracker::impl::reclaim(size_t memory_to_release) { diff --git a/utils/logalloc.hh b/utils/logalloc.hh index d8cc43ac70..90a88597aa 100644 --- a/utils/logalloc.hh +++ b/utils/logalloc.hh @@ -23,7 +23,9 @@ #include #include -#include +#include +#include +#include #include #include #include @@ -464,7 +466,7 @@ public: // Compacts one segment at a time from sparsest segment to least sparse until work_waiting_on_reactor returns true // or there are no more segments to compact. - reactor::idle_cpu_handler_result compact_on_idle(reactor::work_waiting_on_reactor); + idle_cpu_handler_result compact_on_idle(work_waiting_on_reactor); // Compacts as much as possible. Very expensive, mainly for testing. // Guarantees that every live object from reclaimable regions will be moved.