aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Rasmussen <morten.rasmussen@arm.com>2014-10-02 13:45:31 +0100
committerRobin Randhawa <robin.randhawa@arm.com>2015-04-09 12:26:13 +0100
commitb82e7deb5e67f6c6ede8d05dd688431626e07892 (patch)
tree5cb0ab75fd2513e0dbe6600ba28830332e85a77f
parentf3c0c2d50a775d19e5d5f286e61439d863ef2f9c (diff)
downloadkernel-b82e7deb5e67f6c6ede8d05dd688431626e07892.tar.gz
sched: Include blocked utilization in usage tracking
Add the blocked utilization contribution to group sched_entity utilization (se->avg.utilization_avg_contrib) and to get_cpu_usage(). With this change cpu usage now includes recent usage by currently non-runnable tasks, hence it provides a more stable view of the cpu usage. It does, however, also mean that the meaning of usage is changed: A cpu may be momentarily idle while usage >0. It can no longer be assumed that cpu usage >0 implies runnable tasks on the rq. cfs_rq->utilization_load_avg or nr_running should be used instead to get the current rq status. cc: Ingo Molnar <mingo@redhat.com> cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
-rw-r--r--kernel/sched/fair.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 81f1142..dc38c49 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2485,7 +2485,8 @@ static long __update_entity_utilization_avg_contrib(struct sched_entity *se)
__update_task_entity_utilization(se);
else
se->avg.utilization_avg_contrib =
- group_cfs_rq(se)->utilization_load_avg;
+ group_cfs_rq(se)->utilization_load_avg +
+ group_cfs_rq(se)->utilization_blocked_avg;
return se->avg.utilization_avg_contrib - old_contrib;
}
@@ -4538,11 +4539,12 @@ done:
static int get_cpu_usage(int cpu)
{
unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg;
+ unsigned long blocked = cpu_rq(cpu)->cfs.utilization_blocked_avg;
- if (usage >= SCHED_LOAD_SCALE)
+ if (usage + blocked >= SCHED_LOAD_SCALE)
return capacity_orig_of(cpu);
- return usage;
+ return usage + blocked;
}
/*