[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250219-fix-power-allocator-calc-v1-1-48b860291919@chromium.org>
Date: Wed, 19 Feb 2025 15:07:48 +0800
From: Yu-Che Cheng <giver@...omium.org>
To: Lukasz Luba <lukasz.luba@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Chen-Yu Tsai <wenst@...omium.org>, Yu-Che Cheng <giver@...omium.org>
Subject: [PATCH] thermal: gov_power_allocator: Fix incorrect calculation in
divvy_up_power
divvy_up_power should use weighted_req_power instead of req_power to
calculate the granted_power. Otherwise, the granted_power may be
unexpected as the denominator total_req_power is weighted sum.
This is a mistake during the previous refactor.
Replace the req_power with weighted_req_power in divvy_up_power
calculation.
Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
Signed-off-by: Yu-Che Cheng <giver@...omium.org>
---
drivers/thermal/gov_power_allocator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 3b644de3292e..3b626db55b2b 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -370,7 +370,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
for (i = 0; i < num_actors; i++) {
struct power_actor *pa = &power[i];
- u64 req_range = (u64)pa->req_power * power_range;
+ u64 req_range = (u64)pa->weighted_req_power * power_range;
pa->granted_power = DIV_ROUND_CLOSEST_ULL(req_range,
total_req_power);
---
base-commit: 2408a807bfc3f738850ef5ad5e3fd59d66168996
change-id: 20250218-fix-power-allocator-calc-f00b4ab650ba
Best regards,
--
Yu-Che Cheng <giver@...omium.org>
Powered by blists - more mailing lists