diff mbox series

[V2,2/3] sched/fair: update cpu_capcity to reflect thermal pressure

Message ID 1555443521-579-3-git-send-email-thara.gopinath@linaro.org
State New
Headers show
Series Introduce Thermal Pressure | expand

Commit Message

Thara Gopinath April 16, 2019, 7:38 p.m. UTC
cpu_capacity relflects the maximum available capacity of a cpu. Thermal
pressure on a cpu means this maximum available capacity is reduced. This
patch reduces the average thermal pressure for a cpu from its maximum
available capacity so that cpu_capacity reflects the actual
available capacity.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>

---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.1.4
diff mbox series

Patch

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8213ff6..c5454d3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -23,6 +23,7 @@ 
 #include "sched.h"
 
 #include <trace/events/sched.h>
+#include <linux/sched/thermal.h>
 
 /*
  * Targeted preemption latency for CPU-bound tasks:
@@ -7967,6 +7968,9 @@  static void update_cpu_capacity(struct sched_domain *sd, int cpu)
 	if (!capacity)
 		capacity = 1;
 
+	capacity *= sched_get_thermal_pressure(cpu);
+	capacity >>= SCHED_CAPACITY_SHIFT;
+
 	cpu_rq(cpu)->cpu_capacity = capacity;
 	sdg->sgc->capacity = capacity;
 	sdg->sgc->min_capacity = capacity;