On 11/27/2013 02:26 PM, Paul Turner wrote:
load_avg_contrib is not updated while the task is sleeping. It will be updated when the task is reinserted into a runqueue at wakeup. That fact that is retains its old (non-decayed) value is a very useful feature as it allows us to see how the task behaved last time it ran no matter how long it has been sleeping. That is not currently exploited in the mainline scheduler, but it is very important for energy-aware scheduling (and big.LITTLE scheduler support).
For example, webbrowser rendering it quite cpu intensive but doesn't happen very often. So its 'true' load_avg_contrib would be 0, but since it isn't updated we can see that it ran for a long time last time it was scheduled and schedule it on an appropriate cpu instead of assuming that it is a small task.
Yes. If such scenarios happens often, maybe worthy to add a new load_avg_contrib variable to store the old value that you wanted.
I think you are misunderstanding Morten here. He is only highlighting that for highly aperiodic tasks we may (note we do not currently) take advantage of the fact that we can examine them _before_ the load_contrib is updated to reflect their new value. One can imagine such a heuristic might be enabled when we saw that the blocked period exceeded a certain thresh-hold for instance.
Paul, Many thanks for your time and reminder! I missed Morten's explanation in his second email.
Yes, we can check other indicators if we don't want to use unchanged load_contrib in select_task_rq->wake_affine. but the wake_affine is a kind of over tune now. :)
This does not mean that this value was participating in any runnable load average though.