mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: ZhengShaobo <zhengshaobo1@xiaomi.com>
Cc: zhuzhangwei <chuci@xiaomi.com>, Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	dingchongchong <dingchongchong@xiaomi.com>,
	chendejun <chendejun@xiaomi.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal: gov_power_allocator: Granted power set to max when nobody request power
Date: Mon, 21 Oct 2024 23:11:23 +0100	[thread overview]
Message-ID: <0c02c5a3-9eea-495e-aa39-3aac862b5427@arm.com> (raw)
In-Reply-To: <20241021121138.422-1-zhengshaobo1@xiaomi.com>

Hello ZhengShaobo,

On 10/21/24 13:11, ZhengShaobo wrote:
> From: zhengshaobo1 <zhengshaobo1@xiaomi.com>
> 
> 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: zhengshaobo1 <zhengshaobo1@xiaomi.com>
> ---
>   drivers/thermal/gov_power_allocator.c | 18 +++++++++++++-----
>   1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> index 1b2345a697c5..4301516c0938 100644
> --- a/drivers/thermal/gov_power_allocator.c
> +++ b/drivers/thermal/gov_power_allocator.c
> @@ -356,11 +356,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];

Thank you for the patch. Good catch of that corner case.

If there is no load on those devices, then the temperature should
be low, lower than the 1st trip point. In that case we should
reset the PID and call allow_maximum_power()...

Although, what if the temperature is higher, e.g. due to
ambient temperature and no load on the devices. Then we
hit that corner case and your code would help.

LGTM,

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  reply	other threads:[~2024-10-21 22:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 12:11 ZhengShaobo
2024-10-21 22:11 ` Lukasz Luba [this message]
2024-10-23 10:09 ` Rafael J. Wysocki
2024-10-24  8:05   ` ZhengShaobo
2024-10-24  8:14   ` ZhengShaobo
2024-10-24  8:00 ` ZhengShaobo
2024-10-24 15:26   ` Rafael J. Wysocki
2024-10-31  4:06     ` ZhengShaobo

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=0c02c5a3-9eea-495e-aa39-3aac862b5427@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=chendejun@xiaomi.com \
    --cc=chuci@xiaomi.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=dingchongchong@xiaomi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=zhengshaobo1@xiaomi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®