sched: ems: Fix calculate_energy bug
authorlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 3 Sep 2018 04:37:55 +0000 (13:37 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:56 +0000 (20:24 +0300)
Change-Id: I13fda72d1a6529c245108da2d34bb6d40688d8cb
Signed-off-by: lakkyung.jung <lakkyung.jung@samsung.com>
kernel/sched/ems/energy.c

index 5b98131bc3db68865c2970b856ecd510166c793d..d7a13a35e642eb53587b151dde824e22e27aaf1a 100644 (file)
@@ -116,6 +116,12 @@ static unsigned int calculate_energy(struct task_struct *p, int target_cpu)
                 *    cpu usuage that excludes cpu performance.
                 */
                for_each_cpu(i, cpu_coregroup_mask(cpu)) {
+                       if (i == task_cpu(p))
+                               util[i] -= min_t(unsigned long, util[i], task_util_est(p));
+
+                       if (i == target_cpu)
+                               util[i] += task_util_est(p);
+
                        /* utilization with task exceeds max capacity of cpu */
                        if (util[i] >= capacity) {
                                util_sum += SCHED_CAPACITY_SCALE;