[COMMON] sched/rt: Use pelt RT b/w in scale_rt_capacity
authorJohnlay Park <jonglae.park@samsung.com>
Wed, 28 Feb 2018 03:54:30 +0000 (12:54 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:33:12 +0000 (17:33 +0900)
Remove rt tasks from rt_avg metric and directly use the average
b/w of rt scheduler in scale_rt_capacity

Change-Id: Ibcb772c15251aae8924ef1580bf81c9f05a26eb8
Signed-off-by: Johnlay Park <jonglae.park@samsung.com>
kernel/sched/fair.c

index e2a849be4c34bc65c118f657ccbd460cf2ee37b4..9a86694f6d88499092ac89a25f0ceec6d9db53ed 100644 (file)
@@ -8729,23 +8729,16 @@ static inline int get_sd_load_idx(struct sched_domain *sd,
 static unsigned long scale_rt_capacity(int cpu)
 {
        struct rq *rq = cpu_rq(cpu);
-       u64 total, used, age_stamp, avg;
-       s64 delta;
+       s64 used;
 
        /*
-        * Since we're reading these variables without serialization make sure
-        * we read them once before doing sanity checks on them.
+        * Instread of rt_avg in rq, use the sched_rt_avg for more precise caculation
         */
-       age_stamp = READ_ONCE(rq->age_stamp);
-       avg = READ_ONCE(rq->rt_avg);
-       delta = __rq_clock_broken(rq) - age_stamp;
-
-       if (unlikely(delta < 0))
-               delta = 0;
-
-       total = sched_avg_period() + delta;
+       used = rq->rt.avg.util_avg;
 
-       used = div_u64(avg, total);
+       /*
+        * Need to consider bandwidth of deadline tasks
+        */
 
        if (likely(used < SCHED_CAPACITY_SCALE))
                return SCHED_CAPACITY_SCALE - used;