mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
base-hw scheduler: fix bug on removing head
The scheduler did not consider the consumed quota during a call to "update" if the head that consumed the quota was removed from the scheduler. When this occured, the internal round time did not advance as expected but remained at its previous value untile the next call to "update" (without a removed head) This commit introduces a new flag that is set only when the head gets removed in order to detect and handle the situation correctly on the next call to "update". Ref #4151 Ref #4710
This commit is contained in:
parent
ab298b6337
commit
f74962bdad
@ -179,6 +179,13 @@ void Cpu_scheduler::update(time_t time)
|
|||||||
_head_filled(r);
|
_head_filled(r);
|
||||||
|
|
||||||
_consumed(duration);
|
_consumed(duration);
|
||||||
|
|
||||||
|
} else if (_head_was_removed) {
|
||||||
|
|
||||||
|
_trim_consumption(duration);
|
||||||
|
_head_was_removed = false;
|
||||||
|
_head_yields = false;
|
||||||
|
_consumed(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_claim_for_head())
|
if (_claim_for_head())
|
||||||
@ -258,8 +265,10 @@ void Cpu_scheduler::remove(Share &s)
|
|||||||
|
|
||||||
if (s._ready) unready(s);
|
if (s._ready) unready(s);
|
||||||
|
|
||||||
if (&s == _head)
|
if (&s == _head) {
|
||||||
_head = nullptr;
|
_head = nullptr;
|
||||||
|
_head_was_removed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!s._quota)
|
if (!s._quota)
|
||||||
return;
|
return;
|
||||||
|
@ -120,6 +120,7 @@ class Kernel::Cpu_scheduler
|
|||||||
unsigned _head_quota = 0;
|
unsigned _head_quota = 0;
|
||||||
bool _head_claims = false;
|
bool _head_claims = false;
|
||||||
bool _head_yields = false;
|
bool _head_yields = false;
|
||||||
|
bool _head_was_removed = false;
|
||||||
unsigned const _quota;
|
unsigned const _quota;
|
||||||
unsigned _residual;
|
unsigned _residual;
|
||||||
unsigned const _fill;
|
unsigned const _fill;
|
||||||
|
Loading…
Reference in New Issue
Block a user