Re: [PATCH 08/13] Thermal: Introduce fair_share thermal governor
From: Eduardo Valentin <hidden>
Date: 2012-08-21 14:16:20
hello, On Tue, Aug 21, 2012 at 05:59:00AM +0000, R, Durgadoss wrote:
Hi Eduardo,quoted
quoted
+static long get_target_state(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev, int weight, int level) +{ + unsigned long max_state; + + cdev->ops->get_max_state(cdev, &max_state); + + return (long)(weight * level * max_state) / (100 * tz->trips); +} + +static void thermal_cdev_update(struct thermal_cooling_device *cdev) +{ + struct thermal_instance *instance; + unsigned long target = 0; + + mutex_lock(&cdev->lock); + + /* Make sure cdev enters the deepest cooling state */ + list_for_each_entry(instance, &cdev->thermal_instances,cdev_node) {quoted
+ if (instance->target > target) + target = instance->target; + } + + mutex_unlock(&cdev->lock); + + cdev->ops->set_cur_state(cdev, target); +}I believe Rui has already provided an arbitrator, can we reuse it here as well?I thought about this. I was of the opinion a governor can choose to do arbitration in its own specific way. For example, The fair_share does not check 'cdev->updated' value whenever it tries to update the state of a cooling device.
I see. the arbitration starts to get more and more complex. not to talk about constraints coming from performance domain and not thermal. I'd still try to find a central point for doing the arbitration, this way we grow the code in a scalable way...
Thanks, Durga