lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Jan 2024 23:14:33 +0300
From: Jan Dakinevich <jan.dakinevich@...utedevices.com>
To: Michael Turquette <mturquette@...libre.com>, Stephen Boyd
	<sboyd@...nel.org>, <linux-clk@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
CC: <kernel@...utedevices.com>, Jan Dakinevich
	<jan.dakinevich@...utedevices.com>
Subject: [PATCH] clk: allow to skip clk_core_req_round_rate_nolock()

Calling of clk_core_req_round_rate_nolock() can be time-consuming in a
case of deep hierarchy with multiple dividers/parents. But if the clock
already has exactly the same rate as desired, there is no need to
determine how it could be rounded.

Signed-off-by: Jan Dakinevich <jan.dakinevich@...utedevices.com>
---
 drivers/clk/clk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2253c154a824..04f0ddced932 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2423,6 +2423,12 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
 	if (!core)
 		return 0;
 
+	/* skip calculation of rounded rate if the clock already has exactly
+	 * the same rate as desired
+	 */
+	if (req_rate == clk_core_get_rate_nolock(core))
+		return 0;
+
 	rate = clk_core_req_round_rate_nolock(core, req_rate);
 
 	/* bail early if nothing to do */
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ