From: Ionela Voinescu <ionela.voinescu@arm.com>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
daniel.lezcano@linaro.org, amitk@kernel.org,
Dietmar.Eggemann@arm.com
Subject: Re: [PATCH v4 3/3] thermal: power allocator: change the 'k_*' always in estimate_pid_constants()
Date: Thu, 26 Nov 2020 16:00:27 +0000 [thread overview]
Message-ID: <20201126160027.GA28582@arm.com> (raw)
In-Reply-To: <20201124161025.27694-4-lukasz.luba@arm.com>
On Tuesday 24 Nov 2020 at 16:10:25 (+0000), Lukasz Luba wrote:
> The PID coefficients should be estimated again when there was a change to
> sustainable power value made by user. This change removes unused argument
> 'force' and makes the function ready for such updates.
>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
> drivers/thermal/gov_power_allocator.c | 28 +++++++++------------------
> 1 file changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> index d7e4b9f6af60..7a4170a0b51f 100644
> --- a/drivers/thermal/gov_power_allocator.c
> +++ b/drivers/thermal/gov_power_allocator.c
> @@ -117,18 +117,13 @@ static u32 estimate_sustainable_power(struct thermal_zone_device *tz)
> * @sustainable_power: sustainable power for the thermal zone
> * @trip_switch_on: trip point number for the switch on temperature
> * @control_temp: target temperature for the power allocator governor
> - * @force: whether to force the update of the constants
> *
> * This function is used to update the estimation of the PID
> * controller constants in struct thermal_zone_parameters.
> - *
> - * If @force is not set, the values in the thermal zone's parameters
> - * are preserved if they are not zero. If @force is set, the values
> - * in thermal zone's parameters are overwritten.
> */
> static void estimate_pid_constants(struct thermal_zone_device *tz,
> u32 sustainable_power, int trip_switch_on,
> - int control_temp, bool force)
> + int control_temp)
> {
> int ret;
> int switch_on_temp;
> @@ -151,18 +146,14 @@ static void estimate_pid_constants(struct thermal_zone_device *tz,
> if (!temperature_threshold)
> return;
>
> - if (!tz->tzp->k_po || force)
> - tz->tzp->k_po = int_to_frac(sustainable_power) /
> - temperature_threshold;
> + tz->tzp->k_po = int_to_frac(sustainable_power) /
> + temperature_threshold;
>
> - if (!tz->tzp->k_pu || force)
> - tz->tzp->k_pu = int_to_frac(2 * sustainable_power) /
> - temperature_threshold;
> + tz->tzp->k_pu = int_to_frac(2 * sustainable_power) /
> + temperature_threshold;
>
> - if (!tz->tzp->k_i || force) {
> - k_i = tz->tzp->k_pu / 10;
> - tz->tzp->k_i = k_i > 0 ? k_i : 1;
> - }
> + k_i = tz->tzp->k_pu / 10;
> + tz->tzp->k_i = k_i > 0 ? k_i : 1;
>
> /*
> * The default for k_d and integral_cutoff is 0, so we can
> @@ -195,8 +186,7 @@ static u32 get_sustainable_power(struct thermal_zone_device *tz,
> /* Check if it's init value 0 or there was update via sysfs */
> if (sustainable_power != params->sustainable_power) {
> estimate_pid_constants(tz, sustainable_power,
> - params->trip_switch_on, control_temp,
> - true);
> + params->trip_switch_on, control_temp);
>
> /* Do the estimation only once and make available in sysfs */
> tz->tzp->sustainable_power = sustainable_power;
> @@ -640,7 +630,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
> if (!ret)
> estimate_pid_constants(tz, tz->tzp->sustainable_power,
> params->trip_switch_on,
> - control_temp, false);
> + control_temp);
> }
>
> reset_pid_controller(params);
> --
I was actually wondering why we still need force, while reading 2/3.
It looks good!
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
> 2.17.1
>
next prev parent reply other threads:[~2020-11-26 16:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 16:10 [PATCH v4 0/3] Improve the estimations in Intelligent Power Allocation Lukasz Luba
2020-11-24 16:10 ` [PATCH v4 1/3] thermal: power allocator: change the 'k_i' coefficient estimation Lukasz Luba
2020-11-26 16:00 ` Ionela Voinescu
2020-12-07 13:47 ` [thermal: thermal/next] " thermal-bot for Lukasz Luba
2020-11-24 16:10 ` [PATCH v4 2/3] thermal: power allocator: refactor sustainable power estimation Lukasz Luba
2020-11-26 15:59 ` Ionela Voinescu
2020-11-26 16:26 ` Lukasz Luba
2020-12-07 13:47 ` [thermal: thermal/next] " thermal-bot for Lukasz Luba
2020-11-24 16:10 ` [PATCH v4 3/3] thermal: power allocator: change the 'k_*' always in estimate_pid_constants() Lukasz Luba
2020-11-26 16:00 ` Ionela Voinescu [this message]
2020-12-07 13:47 ` [thermal: thermal/next] " thermal-bot for Lukasz Luba
2020-11-26 12:49 ` [PATCH v4 0/3] Improve the estimations in Intelligent Power Allocation Lukasz Luba
2020-11-26 13:09 ` Daniel Lezcano
2020-11-26 14:02 ` Lukasz Luba
2020-11-26 14:30 ` Daniel Lezcano
2020-11-26 14:45 ` Lukasz Luba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201126160027.GA28582@arm.com \
--to=ionela.voinescu@arm.com \
--cc=Dietmar.Eggemann@arm.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.