Skip to content

Commit 0292991

Browse files
committed
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 <[email protected]> Reviewed-by: Lukasz Luba <[email protected]>
1 parent bec5533 commit 0292991

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/thermal/gov_fair_share.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,26 @@
1717

1818
static int get_trip_level(struct thermal_zone_device *tz)
1919
{
20-
const struct thermal_trip *level_trip = NULL;
20+
const struct thermal_trip_desc *level_td = NULL;
2121
const struct thermal_trip_desc *td;
2222
int trip_level = -1;
2323

2424
for_each_trip_desc(tz, td) {
25-
const struct thermal_trip *trip = &td->trip;
26-
27-
if (trip->temperature >= tz->temperature)
25+
if (td->threshold > tz->temperature)
2826
continue;
2927

3028
trip_level++;
3129

32-
if (!level_trip || trip->temperature > level_trip->temperature)
33-
level_trip = trip;
30+
if (!level_td || td->threshold > level_td->threshold)
31+
level_td = td;
3432
}
3533

3634
/* Bail out if the temperature is not greater than any trips. */
3735
if (trip_level < 0)
3836
return 0;
3937

40-
trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, level_trip),
41-
level_trip->type);
38+
trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, &level_td->trip),
39+
level_td->trip.type);
4240

4341
return trip_level;
4442
}

0 commit comments

Comments
 (0)