sched/power: set sum_power to 1 and finish calculation
authorLukasz Luba <l.luba@partner.samsung.com>
Fri, 9 Nov 2018 09:09:24 +0000 (10:09 +0100)
committerLukasz Luba <l.luba@partner.samsung.com>
Fri, 17 May 2019 07:15:51 +0000 (09:15 +0200)
Setting 1 allows to finish calculation and throttle devices.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
kernel/sched/power.c

index 6c72a9bee8ac848c5aaf082d4b3c8053493d6424..5639e6c2825d2ce4f2e9ca9ea0da77eced191e8f 100644 (file)
@@ -707,6 +707,7 @@ static int share_power_budget(struct _thermal_zone *zone, u32 power_budget)
                i++;
        }
 
+       /* protect 'weights' changes in the background */
        mutex_lock(&zone->lock);
        /* estimate cooling dev's power and total power */
        i = 0;
@@ -717,8 +718,8 @@ static int share_power_budget(struct _thermal_zone *zone, u32 power_budget)
        }
        mutex_unlock(&zone->lock);
 
-       if (sum_power <= 0)
-               goto cleanup;
+       if (sum_power == 0)
+               sum_power = 1;
 
        /* split power budget to cooling devices */
        i = 0;
@@ -727,6 +728,8 @@ static int share_power_budget(struct _thermal_zone *zone, u32 power_budget)
                i++;
        }
 
+       /* clamp max possible power for devices and re-share the rest */
+
        /* set the new state for cooling device based on its granted power */
        i = 0;
        list_for_each_entry(inst, &zone->cooling_list, node) {
@@ -734,7 +737,6 @@ static int share_power_budget(struct _thermal_zone *zone, u32 power_budget)
                i++;
        }
 
-cleanup:
        kfree(power);
 
        return 0;