summaryrefslogtreecommitdiff
path: root/drivers/thermal/gov_fair_share.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-10 19:58:56 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-24 11:15:06 +0300
commit0292991ce46c75c28d6ccfe7a7f8ac962a824291 (patch)
treed4cfdd91981fa338e3e6e576e35e20029d0cfcad /drivers/thermal/gov_fair_share.c
parentbec55332c24eb671a1b6de17b38a70dee2472245 (diff)
downloadlinux-0292991ce46c75c28d6ccfe7a7f8ac962a824291.tar.xz
thermal: gov_fair_share: Use trip thresholds instead of trip temperatures
In principle, the Fair Share governor should take trip hysteresis into account. After all, once a trip has been crossed on the way up, mitigation is still needed until it is crossed on the way down. For this reason, make it use trip thresholds that are computed by the core when trips are crossed, so as to apply mitigations if the zone temperature is in a hysteresis rage of one or more trips that were crossed on the way up, but have not been crossed on the way down yet. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal/gov_fair_share.c')
-rw-r--r--drivers/thermal/gov_fair_share.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c
index ff81aeb5ac04..ca6d6152ccf2 100644
--- a/drivers/thermal/gov_fair_share.c
+++ b/drivers/thermal/gov_fair_share.c
@@ -17,28 +17,26 @@
static int get_trip_level(struct thermal_zone_device *tz)
{
- const struct thermal_trip *level_trip = NULL;
+ const struct thermal_trip_desc *level_td = NULL;
const struct thermal_trip_desc *td;
int trip_level = -1;
for_each_trip_desc(tz, td) {
- const struct thermal_trip *trip = &td->trip;
-
- if (trip->temperature >= tz->temperature)
+ if (td->threshold > tz->temperature)
continue;
trip_level++;
- if (!level_trip || trip->temperature > level_trip->temperature)
- level_trip = trip;
+ if (!level_td || td->threshold > level_td->threshold)
+ level_td = td;
}
/* Bail out if the temperature is not greater than any trips. */
if (trip_level < 0)
return 0;
- trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, level_trip),
- level_trip->type);
+ trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, &level_td->trip),
+ level_td->trip.type);
return trip_level;
}