diff --git a/src/mx/memory/global_heap.h b/src/mx/memory/global_heap.h index 5f3a939..4ade108 100644 --- a/src/mx/memory/global_heap.h +++ b/src/mx/memory/global_heap.h @@ -7,6 +7,7 @@ namespace mx::memory { /** * The global heap represents the heap, provided by the OS. + * TODO: Use Genode's interface here. */ class GlobalHeap { diff --git a/src/mx/memory/reclamation/epoch_manager.cpp b/src/mx/memory/reclamation/epoch_manager.cpp index f00ca45..31f1635 100644 --- a/src/mx/memory/reclamation/epoch_manager.cpp +++ b/src/mx/memory/reclamation/epoch_manager.cpp @@ -40,6 +40,7 @@ void EpochManager::enter_epoch_periodically() } // Wait some time until next epoch. + // TODO: Use native Genode method std::this_thread::sleep_for(config::epoch_interval()); // NOLINT: sleep_for seems to crash clang-tidy } } diff --git a/src/mx/memory/reclamation/epoch_manager.h b/src/mx/memory/reclamation/epoch_manager.h index 849d31f..33b6939 100644 --- a/src/mx/memory/reclamation/epoch_manager.h +++ b/src/mx/memory/reclamation/epoch_manager.h @@ -15,7 +15,6 @@ #include #include #include -#include namespace mx::memory::reclamation { class alignas(64) LocalEpoch diff --git a/src/mx/system/environment.h b/src/mx/system/environment.h index f975a83..dab366d 100644 --- a/src/mx/system/environment.h +++ b/src/mx/system/environment.h @@ -1,6 +1,7 @@ #pragma once #include +#include namespace mx::system { /** @@ -9,18 +10,18 @@ namespace mx::system { class Environment { public: + + /** + * @return Genode environment capability + * + */ + Genode::Env &env; + /** * @return True, if NUMA balancing is enabled by the system. */ static bool is_numa_balancing_enabled() { - std::ifstream numa_balancing_file("/proc/sys/kernel/numa_balancing"); - auto is_enabled = std::int32_t{}; - if (numa_balancing_file >> is_enabled) - { - return !(is_enabled == 0); - } - return true; } diff --git a/src/mx/system/topology.h b/src/mx/system/topology.h index 43c155f..cabad2e 100644 --- a/src/mx/system/topology.h +++ b/src/mx/system/topology.h @@ -3,8 +3,6 @@ #include #include #include -#include -#include namespace mx::system { /** @@ -17,7 +15,7 @@ public: /** * @return Core where the caller is running. */ - static std::uint16_t core_id() { return std::uint16_t(sched_getcpu()); } + static std::uint16_t core_id() { return std::uint16_t(0); // no way of getting CPU id yet } /** * Reads the NUMA region identifier of the given core. @@ -25,16 +23,19 @@ public: * @param core_id Id of the core. * @return Id of the NUMA region the core stays in. */ - static std::uint8_t node_id(const std::uint16_t core_id) { return std::max(numa_node_of_cpu(core_id), 0); } + static std::uint8_t node_id(const std::uint16_t core_id) { + return 0; // no NUMA support yet + } /** * @return The greatest NUMA region identifier. */ - static std::uint8_t max_node_id() { return std::uint8_t(numa_max_node()); } + static std::uint8_t max_node_id() { return std::uint8_t(1); } /** * @return Number of available cores. */ - static std::uint16_t count_cores() { return std::uint16_t(std::thread::hardware_concurrency()); } + static std::uint16_t count_cores() { return std::uint16_t(Environment::env.cpu().affinity_space().total); + } }; } // namespace mx::system \ No newline at end of file diff --git a/src/mx/tasking/scheduler.cpp b/src/mx/tasking/scheduler.cpp index beafa7c..a3a85dc 100644 --- a/src/mx/tasking/scheduler.cpp +++ b/src/mx/tasking/scheduler.cpp @@ -41,6 +41,7 @@ Scheduler::~Scheduler() noexcept void Scheduler::start_and_wait() { // Create threads for worker... + // TODO: Use Genode's thread interface instead of POSIX threads std::vector worker_threads(this->_core_set.size() + static_cast(config::memory_reclamation() != config::None)); for (auto channel_id = 0U; channel_id < this->_core_set.size(); ++channel_id)