[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411403047-32010-7-git-send-email-morten.rasmussen@arm.com>
Date: Mon, 22 Sep 2014 17:24:06 +0100
From: Morten Rasmussen <morten.rasmussen@....com>
To: peterz@...radead.org, mingo@...hat.com
Cc: dietmar.eggemann@....com, pjt@...gle.com, bsegall@...gle.com,
vincent.guittot@...aro.org, nicolas.pitre@...aro.org,
mturquette@...aro.org, rjw@...ysocki.net,
linux-kernel@...r.kernel.org,
Morten Rasmussen <morten.rasmussen@....com>
Subject: [PATCH 6/7] sched: Make sched entity usage tracking scale-invariant
Apply scale-invariance correction factor to usage tracking as well.
cc: Paul Turner <pjt@...gle.com>
cc: Ben Segall <bsegall@...gle.com>
Signed-off-by: Morten Rasmussen <morten.rasmussen@....com>
---
kernel/sched/fair.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d8a8c83..c7aa8c1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2302,9 +2302,9 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
int runnable,
int running)
{
- u64 delta, periods;
- u32 runnable_contrib;
- int delta_w, decayed = 0;
+ u64 delta, scaled_delta, periods;
+ u32 runnable_contrib, scaled_runnable_contrib;
+ int delta_w, scaled_delta_w, decayed = 0;
u32 scale_cap = arch_scale_load_capacity(cpu);
delta = now - sa->last_runnable_update;
@@ -2339,11 +2339,12 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
*/
delta_w = 1024 - delta_w;
+ scaled_delta_w = (delta_w * scale_cap) >> SCHED_CAPACITY_SHIFT;
+
if (runnable)
- sa->runnable_avg_sum += (delta_w * scale_cap)
- >> SCHED_CAPACITY_SHIFT;
+ sa->runnable_avg_sum += scaled_delta_w;
if (running)
- sa->usage_avg_sum += delta_w;
+ sa->usage_avg_sum += scaled_delta_w;
sa->runnable_avg_period += delta_w;
delta -= delta_w;
@@ -2361,20 +2362,23 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
/* Efficiently calculate \sum (1..n_period) 1024*y^i */
runnable_contrib = __compute_runnable_contrib(periods);
- if (runnable)
- sa->runnable_avg_sum += (runnable_contrib * scale_cap)
+ scaled_runnable_contrib = (runnable_contrib * scale_cap)
>> SCHED_CAPACITY_SHIFT;
+
+ if (runnable)
+ sa->runnable_avg_sum += scaled_runnable_contrib;
if (running)
- sa->usage_avg_sum += runnable_contrib;
+ sa->usage_avg_sum += scaled_runnable_contrib;
sa->runnable_avg_period += runnable_contrib;
}
/* Remainder of delta accrued against u_0` */
+ scaled_delta = (delta * scale_cap) >> SCHED_CAPACITY_SHIFT;
+
if (runnable)
- sa->runnable_avg_sum += (delta * scale_cap)
- >> SCHED_CAPACITY_SHIFT;
+ sa->runnable_avg_sum += scaled_delta;
if (running)
- sa->usage_avg_sum += delta;
+ sa->usage_avg_sum += scaled_delta;
sa->runnable_avg_period += delta;
return decayed;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists