mirror of
https://github.com/mmueller41/mxtasking.git
synced 2026-01-21 12:42:57 +01:00
Marked code that needs to be changed for Genode.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <mx/util/core_set.h>
|
||||
#include <mx/util/maybe_atomic.h>
|
||||
#include <mx/util/mpsc_queue.h>
|
||||
#include <thread>
|
||||
|
||||
namespace mx::memory::reclamation {
|
||||
class alignas(64) LocalEpoch
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <base/component.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <numa.h>
|
||||
#include <sched.h>
|
||||
#include <thread>
|
||||
|
||||
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
|
||||
@@ -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<std::thread> worker_threads(this->_core_set.size() +
|
||||
static_cast<std::uint16_t>(config::memory_reclamation() != config::None));
|
||||
for (auto channel_id = 0U; channel_id < this->_core_set.size(); ++channel_id)
|
||||
|
||||
Reference in New Issue
Block a user