]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thermal: gov_power_allocator: Granted power set to max when nobody request power
authorZhengShaobo <zhengshaobo1@xiaomi.com>
Mon, 21 Oct 2024 12:11:38 +0000 (20:11 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Oct 2024 15:24:03 +0000 (17:24 +0200)
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 <zhengshaobo1@xiaomi.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20241021121138.422-1-zhengshaobo1@xiaomi.com
[ rjw: Fixed up tags ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/gov_power_allocator.c

index 5cb03923fa8f2f02422301e69c244c44ce78dea6..ac6fa6b8f99f001eb8c042c528792e8df640f30a 100644 (file)
@@ -354,11 +354,19 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
        u32 extra_power = 0;
        int i;
 
-       /*
-        * Prevent division by 0 if none of the actors request power.
-        */
-       if (!total_req_power)
-               total_req_power = 1;
+       if (!total_req_power) {
+               /*
+                * Nobody requested anything, just give everybody
+                * the maximum power
+                */
+               for (i = 0; i < num_actors; i++) {
+                       struct power_actor *pa = &power[i];
+
+                       pa->granted_power = pa->max_power;
+               }
+
+               return;
+       }
 
        for (i = 0; i < num_actors; i++) {
                struct power_actor *pa = &power[i];