The scale_rt_power() used to represent the left CPU utilization after reduce rt utilization. so named it as scale_rt_power has a bit inappropriate.
Since we need to use the rt utilization in some incoming patches, we just change return value of this function to rt utilization, and rename it as scale_rt_util(). Then, its usage is changed in update_cpu_power() accordingly. Signed-off-by: Alex Shi <alex....@intel.com> --- kernel/sched/fair.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a0bd2f3..c47933f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4277,10 +4277,10 @@ unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu) return default_scale_smt_power(sd, cpu); } -unsigned long scale_rt_power(int cpu) +unsigned long scale_rt_util(int cpu) { struct rq *rq = cpu_rq(cpu); - u64 total, available, age_stamp, avg; + u64 total, age_stamp, avg; /* * Since we're reading these variables without serialization make sure @@ -4292,10 +4292,8 @@ unsigned long scale_rt_power(int cpu) total = sched_avg_period() + (rq->clock - age_stamp); if (unlikely(total < avg)) { - /* Ensures that power won't end up being negative */ - available = 0; - } else { - available = total - avg; + /* Ensures rt utilization won't beyond full scaled value */ + return SCHED_POWER_SCALE; } if (unlikely((s64)total < SCHED_POWER_SCALE)) @@ -4303,7 +4301,7 @@ unsigned long scale_rt_power(int cpu) total >>= SCHED_POWER_SHIFT; - return div_u64(available, total); + return div_u64(avg, total); } static void update_cpu_power(struct sched_domain *sd, int cpu) @@ -4330,7 +4328,7 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) power >>= SCHED_POWER_SHIFT; - power *= scale_rt_power(cpu); + power *= SCHED_POWER_SCALE - scale_rt_util(cpu); power >>= SCHED_POWER_SHIFT; if (!power) -- 1.7.12 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/