diff options
author | Chen-Yu Tsai <wenst@chromium.org> | 2025-08-14 06:53:16 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2025-09-21 20:15:43 +0300 |
commit | 4bf2d2744e641886a1320bae7e8877f639a1c961 (patch) | |
tree | 6374906874509be5d46f7e634e640aa23623c31b /rust/kernel/irq/request.rs | |
parent | 904bed39490cc112b4c66b2ab035e5325cdbfbb6 (diff) | |
download | linux-4bf2d2744e641886a1320bae7e8877f639a1c961.tar.xz |
clk: Use hashtable for global clk lookups
A clk lookup using clk_core_lookup() is currently somewhat expensive
since it has to walk the whole clk tree to find a match. This is
extremely bad in the clk_core_init() function where it is used to look
for clk name conflicts, which is always the worst case of walking the
whole tree. Moreover, the number of clks checked increases as more
clks are registered, causing each subsequent clk registration becoming
slower.
Add a hashtable for doing clk lookups to replace the tree walk method.
On arm64 this increases kernel memory usage by 4 KB for the hashtable,
and 16 bytes (2 pointers) for |struct hlist_node| in each clk. On a
platform with around 800 clks, this reduces the time spent in
clk_core_lookup() significantly:
| PID 0 | kworker |
| before | after | before | after |
-------------------------------------------
avg | 203 us | 2.7 us | 123 us | 1.5 us |
-------------------------------------------
min | 4.7 us | 2.3 us | 102 us | 0.9 us |
-------------------------------------------
max | 867 us | 4.8 us | 237 us | 3.5 us |
-------------------------------------------
culm | 109 ms | 1.5 ms | 21 ms | 0.3 ms |
This in turn reduces the time spent in clk_hw_register(), and
ultimately, boot time. On a different system with close to 700 clks,
This reduces boot time by around 110 ms. While this doesn't seem like
a lot, this helps in cases where minimizing boot time is important.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'rust/kernel/irq/request.rs')
0 files changed, 0 insertions, 0 deletions