add priorities for vgpus

This commit is contained in:
Marcel Lütke Dreimann
2023-01-12 14:31:31 +01:00
parent b623371208
commit edf6a01cb8
2 changed files with 25 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ void CompletlyFair::removeVGPU(VGpu* vgpu)
VGpu* CompletlyFair::nextVGPU()
{
// update cfs entry
_curr->runtime += rdtsc() - _curr->ts;
_curr->runtime += (rdtsc() - _curr->ts) * -_curr->vgpu->getPriority();
// list empty?
if(_run_list.empty())

View File

@@ -22,11 +22,34 @@ namespace gpgpu_virt {
/// list of gpgpu tasks for this vpgu
Genode::Fifo<Kernel> ready_list;
/// priority of vgpu
int prio;
public:
/**
* @brief Construct a new VGpu object
*/
VGpu() : ctx(nullptr), ready_list() {}
VGpu() : ctx(nullptr), ready_list(), prio(-1) {}
/**
* @brief Set the Priority
*
* @param p
*/
void setPriority(int p)
{
prio = p;
}
/**
* @brief Get the Priority
*
* @return int
*/
int getPriority()
{
return prio;
}
/**
* @brief Add a kernel to the vGPU's ready list