linux/drivers/infiniband
Junxian Huang fe51f6254d RDMA/hns: Optimize hem allocation performance
When allocating MTT hem, for each hop level of each hem that is being
allocated, the driver iterates the hem list to find out whether the
bt page has been allocated in this hop level. If not, allocate a new
one and splice it to the list. The time complexity is O(n^2) in worst
cases.

Currently the allocation for-loop uses 'unit' as the step size. This
actually has taken into account the reuse of last-hop-level MTT bt
pages by multiple buffer pages. Thus pages of last hop level will
never have been allocated, so there is no need to iterate the hem list
in last hop level.

Removing this unnecessary iteration can reduce the time complexity to
O(n).

Fixes: 38389eaa4d ("RDMA/hns: Add mtr support for mixed multihop addressing")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20240906093444.3571619-9-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2024-09-10 16:06:39 +03:00
..
core IB/core: Fix ib_cache_setup_one error flow cleanup 2024-09-04 10:33:09 +03:00
hw RDMA/hns: Optimize hem allocation performance 2024-09-10 16:06:39 +03:00
sw RDMA/rdmavt: Convert to use ERR_CAST() 2024-09-02 10:09:42 +03:00
ulp RDMA/rtrs-clt: Remove an extra space 2024-08-28 15:24:35 +03:00
Kconfig RDMA: Disable IB HW for UML 2022-12-04 15:22:03 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00