On Tue, Jun 03, 2014 at 04:59:39PM +0100, Peter Zijlstra wrote:
On Tue, Jun 03, 2014 at 01:03:54PM +0100, Morten Rasmussen wrote:
An unweighted version of cfs.runnable_load_avg gives you a metric that captures cpu utilization to some extend, but not the number of tasks. And it reflects task migrations immediately unlike the rq runnable_avg_sum.
So runnable_avg would be equal to the utilization as long as there's idle time, as soon as we're over-loaded the metric shows how much extra cpu is required.
That is, runnable_avg - running_avg >= 0 and the amount is the exact amount of extra cpu required to make all tasks run but not have idle time.
Yes, roughly. runnable_avg goes up quite steeply if you have many tasks on a fully utilized cpu, so the actual amount of extra cpu required might be somewhat lower. I can't come up with something better, so I agree.
Agreed, but I think it is quite important to discuss what we understand by cpu utilization. It seems to be different depending on what you want to use it for.
I understand utilization to be however much cpu is actually used, so I would, per the existing naming, call running_avg to be the avg utilization of a task/group/cpu whatever.
I see your point, but for load balancing purposes we are more intested in the runnable_avg as it tells us about the cpu capacity requirements. I don't like to throw more terms into the mix, but you could call runnable_avg the potential task/group/cpu utilization. This is an estimate of how much utilization a task would cause if we moved it to an idle cpu. That might be quite different from running_avg on an over-utilized cpu.
We have done experiments internally with rq runnable_avg_sum for load-balancing decisions in the past and found it unsuitable due to its slow response to task migrations. That is why I brought it up here.
So I'm not entirely seeing that from the code (I've not traced this), afaict we actually update the per-cpu values on migration based on the task values.
old_rq->sum -= p->val; new_rq->sum += p->val;
like,.. except of course totally obscured.
Yes, for cfs.runnable_load_avg, rq->avg.runnable_avg_sum is different. See the other reply.