Patch "RDMA/hns: Optimize hem allocation performance" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/hns: Optimize hem allocation performance

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-hns-optimize-hem-allocation-performance.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d744ea2629a5e801998d45a4304e81ab47521b68
Author: Junxian Huang <huangjunxian6@xxxxxxxxxxxxx>
Date:   Fri Sep 6 17:34:43 2024 +0800

    RDMA/hns: Optimize hem allocation performance
    
    [ Upstream commit fe51f6254d81f5a69c31df16353d6539b2b51630 ]
    
    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: 38389eaa4db1 ("RDMA/hns: Add mtr support for mixed multihop addressing")
    Signed-off-by: Junxian Huang <huangjunxian6@xxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240906093444.3571619-9-huangjunxian6@xxxxxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c
index 156bc710e0dbb..2c8f0fd9557d1 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
@@ -1175,10 +1175,12 @@ static int hem_list_alloc_mid_bt(struct hns_roce_dev *hr_dev,
 
 	/* config L1 bt to last bt and link them to corresponding parent */
 	for (level = 1; level < hopnum; level++) {
-		cur = hem_list_search_item(&mid_bt[level], offset);
-		if (cur) {
-			hem_ptrs[level] = cur;
-			continue;
+		if (!hem_list_is_bottom_bt(hopnum, level)) {
+			cur = hem_list_search_item(&mid_bt[level], offset);
+			if (cur) {
+				hem_ptrs[level] = cur;
+				continue;
+			}
 		}
 
 		step = hem_list_calc_ba_range(hopnum, level, unit);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux