]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
thermal: gov_power_allocator: Fix incorrect calculation in divvy_up_power()
authorYu-Che Cheng <giver@chromium.org>
Wed, 19 Feb 2025 07:07:48 +0000 (15:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 17:25:34 +0000 (18:25 +0100)
commit806437d047472a81f4df5960451ec705b8c45a4f
treebae849859740b2d3cb30e8f502289e5d4ef17d71
parent99dcd630ac2136a11918de111e1f1a41dfc17098
thermal: gov_power_allocator: Fix incorrect calculation in divvy_up_power()

[ Upstream commit 4ecaa75771a75f2b78a431bf67dea165d19d72a6 ]

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: 912e97c67cc3 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/gov_power_allocator.c