From nobody Tue Nov 26 04:31:03 2024 Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [118.143.206.90]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE1C41DA314; Mon, 21 Oct 2024 12:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.143.206.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729512775; cv=none; b=CR/Atc5eWTIToSxUrQj9OqFL4A3KfufEqkro7VvmHnPTp6OT9XbQp7NnldEIzU7gAoe4O/eOjD8tP7WVZe8d+W9zSOzokcf7g4U8RIQYaN94hPk7sj2rcQQ+05BCm9YvA8ZLBQgXoZ0qpNzVyYyTLkenMra2mi4LSeX46ubfpFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729512775; c=relaxed/simple; bh=knWulEp3Y8VsTxmNEmN7lvDWgNciIS+AGlFK3WZJVTk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MCWlIVK/SSX69zX90Hym1AIKpuzjNFQbuvcAT5/S7mE09sLnK1uUAr/VZcAW7eVZ9mheuTmy5fm4zERaPKe40l3TlvXBOThUumDC5XV8ln20Apvst6gu2n+lRLAjcpqeOUv72bGXuREhxIubQAPEyIbFOQo926G23O1zYQkI3lw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com; spf=pass smtp.mailfrom=xiaomi.com; arc=none smtp.client-ip=118.143.206.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaomi.com X-CSE-ConnectionGUID: 9sRJT4PMSSK/gjHv2KG29Q== X-CSE-MsgGUID: aHGXw6PQQguRCuSVron6Qw== X-IronPort-AV: E=Sophos;i="6.11,220,1725292800"; d="scan'208";a="99300552" From: ZhengShaobo To: Lukasz Luba , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , , CC: zhuzhangwei , dingchongchong , chendejun , zhengshaobo1 Subject: [PATCH] thermal: gov_power_allocator: Granted power set to max when nobody request power Date: Mon, 21 Oct 2024 20:11:38 +0800 Message-ID: <20241021121138.422-1-zhengshaobo1@xiaomi.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: bj-mbx09.mioffice.cn (10.237.8.129) To BJ-MBX15.mioffice.cn (10.237.8.135) Content-Type: text/plain; charset="utf-8" From: zhengshaobo1 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 Reviewed-by: Lukasz Luba --- 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_po= wer_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 =3D 0; int i; =20 - /* - * Prevent division by 0 if none of the actors request power. - */ - if (!total_req_power) - total_req_power =3D 1; + if (!total_req_power) { + /* + * Nobody requested anything, just give everybody + * the maximum power + */ + for (i =3D 0; i < num_actors; i++) { + struct power_actor *pa =3D &power[i]; + + pa->granted_power =3D pa->max_power; + } + + return; + } =20 for (i =3D 0; i < num_actors; i++) { struct power_actor *pa =3D &power[i]; --=20 2.43.0