sched/power: change calc budget params
authorLukasz Luba <l.luba@partner.samsung.com>
Thu, 8 Nov 2018 09:43:13 +0000 (10:43 +0100)
committerLukasz Luba <l.luba@partner.samsung.com>
Fri, 17 May 2019 07:15:46 +0000 (09:15 +0200)
Change calculation parameters

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

index 327f49a670d21d2f00d5d065f03803bd3660c06f..c66c8dca246583ae9e5549c0288259d87e793a38 100644 (file)
@@ -518,13 +518,14 @@ static u64 estimate_total_min_power(struct thermal_zone_device *tz, int trip)
        return total_min_power;
 }
 
-static u64 calc_power_budget(struct thermal_zone_device *tz, int desire_temp)
+static u32 calc_power_budget(struct _thermal_zone *zone, int control_temp)
 {
        s64 temp_diff;
        s64 power_budget;
+       struct thermal_zone_device *tz = zone->tz;
 
        /* temperature is represented in milidegress */
-       temp_diff = desire_temp - tz->temperature;
+       temp_diff = control_temp - tz->temperature;
 
        power_budget = temp_diff;
 
@@ -554,7 +555,7 @@ static struct _thermal_zone *find_zone(struct thermal_zone_device *tz)
 
        return NULL;
 }
-static int inject_more_idle(struct _thermal_zone *zone)
+static int inject_more_idle(struct _thermal_zone *zone, u32 power_budget)
 {
 
        return 0;
@@ -573,6 +574,8 @@ static int sched_power_gov_throttle(struct thermal_zone_device *tz, int trip)
        struct thermal_cooling_device *cdev = NULL;
        struct thermal_instance *inst = NULL;
        u32 dev_power;
+       u32 power_budget;
+       int control_temp = 0;
        struct _thermal_zone *zone;
        int ret;
 
@@ -580,9 +583,11 @@ static int sched_power_gov_throttle(struct thermal_zone_device *tz, int trip)
        if (!zone)
                return -EINVAL;
 
+
        if (zone->single_cooling_dev) {
-               /* ret = calc_power_budget(tz); */
-               ret = inject_more_idle(zone);
+               power_budget = calc_power_budget(zone, control_temp);
+               /* only deadline tasks can ask for over-speed with idlers */
+               ret = inject_more_idle(zone, power_budget);
                if (ret) {
                        throttle_single_cdev(zone);
                        power_actor_set_power(cdev, inst, dev_power);