hw: remove Cpu_scheduler::_trim_consumption

This private, internal function is used only in one scope,
and therefore not neccessary. But it has nasty side-effects as
it takes the parameter `duration` as reference and changes its
value. Just remove it completely.

Ref genodelabs/genode#5115
This commit is contained in:
Stefan Kalkowski 2024-02-07 15:21:09 +01:00 committed by Christian Helmuth
parent 1c4078f23a
commit c8380c1447
2 changed files with 5 additions and 15 deletions

View File

@ -120,16 +120,6 @@ bool Cpu_scheduler::_schedule_fill()
}
unsigned Cpu_scheduler::_trim_consumption(unsigned &q)
{
q = Genode::min(Genode::min(q, _current_quantum), _super_period_left);
if (_state != YIELD)
return _current_quantum - q;
return 0;
}
void Cpu_scheduler::_quota_introduction(Share &s)
{
if (s._ready) _rcl[s._prio].insert_tail(&s._claim_item);
@ -155,12 +145,14 @@ void Cpu_scheduler::update(time_t time)
{
using namespace Genode;
unsigned duration = (unsigned) (time - _last_time);
_last_time = time;
unsigned const r = _trim_consumption(duration);
unsigned const duration =
min(min((unsigned)(time-_last_time), _current_quantum),
_super_period_left);
_last_time = time;
/* do not detract the quota if the current share was removed even now */
if (_current) {
unsigned const r = (_state != YIELD) ? _current_quantum - duration : 0;
if (_current->_claim) _current_claimed(r);
else _current_filled(r);
}

View File

@ -232,8 +232,6 @@ class Kernel::Cpu_scheduler
bool _schedule_claim();
bool _schedule_fill();
unsigned _trim_consumption(unsigned &q);
/**
* Fill 's' becomes a claim due to a quota donation
*/