Changed worker loop to watch out for yield signal. Also, removed the pinning as this is done when the worker's thread is created.

This commit is contained in:
Michael Mueller
2024-02-13 19:45:01 +01:00
parent 4b13aa18e7
commit 521d325129

View File

@@ -12,6 +12,7 @@
#include <chrono>
#include <base/log.h>
#include <trace/timestamp.h>
#include <nova/syscalls.h>
using namespace mx::tasking;
@@ -27,12 +28,12 @@ Worker::Worker(const std::uint16_t id, const std::uint16_t target_core_id, const
void Worker::execute()
{
{
/*{
Genode::Thread *self = Genode::Thread::myself();
Genode::Affinity::Location loc = system::Environment::location(_target_core_id);
self->pin(loc);
}
}*/
while (this->_is_running == false)
{
@@ -41,10 +42,11 @@ void Worker::execute()
TaskInterface *task;
const auto core_id = system::topology::core_id();
assert(this->_target_core_id == core_id && "Worker not pinned to correct core.");
//assert(this->_target_core_id == core_id && "Worker not pinned to correct core.");
const auto channel_id = this->_channel.id();
const auto phys_core_id = system::Environment::topo().phys_id(Genode::Thread::myself()->affinity());
std::uint64_t *volatile tukija_signal = &_tukija_signal[phys_core_id];
while (this->_is_running)
{
@@ -55,6 +57,10 @@ void Worker::execute()
this->_channel_size = this->_channel.fill();
if (this->_channel_size == 0) {
Nova::yield(true);
}
if constexpr (config::task_statistics())
{
this->_statistic.increment<profiling::Statistic::Fill>(channel_id);
@@ -130,6 +136,10 @@ void Worker::execute()
{
runtime::delete_task(core_id, task);
}
if (__atomic_load_n(tukija_signal, __ATOMIC_SEQ_CST)) {
Nova::yield(false);
}
}
}
}