Skip to content

Commit 08eb049

Browse files
ZhengShaoborafaeljw
authored andcommitted
thermal: gov_power_allocator: Granted power set to max when nobody request power
When total_req_power is 0, divvy_up_power() will set granted_power to 0, and cdev will be limited to the lowest performance. If our polling delay is set to 200ms, it means that cdev cannot perform better within 200ms even if cdev has a sudden load. This will affect the performance of cdev and is not as expected. For this reason, if nobody requests power, then set the granted power to the max_power. Signed-off-by: ZhengShaobo <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Fixed up tags ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 43bac10 commit 08eb049

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,19 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
354354
u32 extra_power = 0;
355355
int i;
356356

357-
/*
358-
* Prevent division by 0 if none of the actors request power.
359-
*/
360-
if (!total_req_power)
361-
total_req_power = 1;
357+
if (!total_req_power) {
358+
/*
359+
* Nobody requested anything, just give everybody
360+
* the maximum power
361+
*/
362+
for (i = 0; i < num_actors; i++) {
363+
struct power_actor *pa = &power[i];
364+
365+
pa->granted_power = pa->max_power;
366+
}
367+
368+
return;
369+
}
362370

363371
for (i = 0; i < num_actors; i++) {
364372
struct power_actor *pa = &power[i];

0 commit comments

Comments
 (0)