Skip to content

Commit 4ecaa75

Browse files
ggiverrafaeljw
authored andcommitted
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 granted_power. Otherwise, granted_power may be unexpected as the denominator total_req_power is a weighted sum. This is a mistake made during the previous refactor. Replace req_power with weighted_req_power in divvy_up_power() calculation. Fixes: 912e97c ("thermal: gov_power_allocator: Move memory allocation out of throttle()") Signed-off-by: Yu-Che Cheng <giver@chromium.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20250219-fix-power-allocator-calc-v1-1-48b860291919@chromium.org [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 0ad2507 commit 4ecaa75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
370370

371371
for (i = 0; i < num_actors; i++) {
372372
struct power_actor *pa = &power[i];
373-
u64 req_range = (u64)pa->req_power * power_range;
373+
u64 req_range = (u64)pa->weighted_req_power * power_range;
374374

375375
pa->granted_power = DIV_ROUND_CLOSEST_ULL(req_range,
376376
total_req_power);

0 commit comments

Comments
 (0)