[haiku-commits] Re: BRANCH pdziepak-github.master [a96e17b] src/system/kernel/scheduler

  • From: Pawel Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 7 Feb 2014 01:44:16 +0100

2014-02-06 11:44 GMT+01:00 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
>> On February 6, 2014 at 4:01 AM "pdziepak-github.master"
>> <community@xxxxxxxxxxxx> wrote:
>>   The solution to this problem is to add a timer each time an idle thread is
>>   scheudled which, after kLoadMeasureInterval, would fire and force load
>>   update.
>
> Wouldn't that make it tick again (as opposed to tickless)?

No, it wouldn't. When an idle thread is scheduled (and the previous
therad wasn't idle) a one shot timer is added that invokes
CPUEntry::_UpdateLoadEvent (as opposed to CPUEntry::_RescheduleEvent
for non-idle threads). After that timer fires and load is updated the
scheduler causes no more ticks until a ready thread arrives.

> Also, I don't understand why this would be necessary. Why would the load 
> changes
> when the idle thread runs? Isn't that always triggered by external events that
> could instead update the load statistics?

Theread load is an average load of a thread in the last
kLoadMeasureInterval (well, strictly speaking it is estimated load the
thread would produce if there were no other active threads, but that's
not really important here), core load is a sum of loads of all threads
that has been active on that core during last kLoadMeasureInterval.
When an idle thread is scheduled the core may still be in a middle of
load measurement interval and its load can not be updated immediately
(if it was such statistics wouldn't be of much use, e.g. if there was
one active thread producing 50% core load would be 0% for 50% of
time). That's why core load has to be updated with a certain delay
(unless we know for sure that the thread won't come back because it
has been migrated or no longer exists) and therefore a one shot timer
is needed when scheduling an idle thread.

Paweł

Other related posts: