use fifo also for vgpus

This commit is contained in:
Marcel Lütke Dreimann
2022-09-12 18:45:35 +02:00
parent e554b84b7b
commit 235d9b9284
3 changed files with 12 additions and 11 deletions

View File

@@ -18,15 +18,17 @@ void Scheduler::schedule_next()
VGpu* first = nullptr;
do
{
VGpu* next;
if ((next = static_cast<VGpu*>(_run_list.first())))
VGpu* next = nullptr;
_run_list.dequeue([&next](VGpu& vgpu){
next = &vgpu;
});
if(next != nullptr)
{
// set vgpu
_curr_vgpu = next;
// move vgpu to end of list
_run_list.remove(next);
_run_list.insert(next);
// add vgpu back to end of list
_run_list.enqueue(*next);
// complete iteration?
if(first == next)

View File

@@ -1,7 +1,7 @@
#ifndef SCHEDULER_H
#define SCHEDULER_H
#include <util/list.h>
#include <util/fifo.h>
#include "vgpu.h"
namespace gpgpu_virt {
@@ -10,7 +10,7 @@ namespace gpgpu_virt {
{
private:
VGpu* _curr_vgpu;
Genode::List<VGpu> _run_list;
Genode::Fifo<VGpu> _run_list;
bool idle;
public:
@@ -50,7 +50,7 @@ namespace gpgpu_virt {
*/
void add_vgpu(VGpu* vgpu)
{
_run_list.insert(vgpu);
_run_list.enqueue(*vgpu);
}
/**
@@ -60,7 +60,7 @@ namespace gpgpu_virt {
*/
void remove_vgpu(VGpu* vgpu)
{
_run_list.remove(vgpu);
_run_list.remove(*vgpu);
}
/**

View File

@@ -1,7 +1,6 @@
#ifndef VGPU_H
#define VGPU_H
#include <util/list.h>
#include <util/fifo.h>
#include "kernel.h"
@@ -12,7 +11,7 @@
namespace gpgpu_virt {
class VGpu : public Genode::List<VGpu>::Element
class VGpu : public Genode::Fifo<VGpu>::Element
{
private:
// context of vgpu