From: Alexey Lyashkov Date: Fri, 30 May 2025 09:32:44 +0000 (+0300) Subject: LU-19075 o2iblnd: reduce memory usage X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a202a9b6f758919a7b8b1030ebd1ac52bdf85900;p=fs%2Flustre-release.git LU-19075 o2iblnd: reduce memory usage ib_recv_wr / ib_sge are not needed after ib_post_recv finished. lets remove it. Test-Parameters: trivial Signed-off-by: Alexey Lyashkov Change-Id: Id866c1bbaeafa41103ef7caa8a1254c53c9e3c3d Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59488 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Chris Horn Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 63adb44..c48ed4b 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -487,10 +487,6 @@ struct kib_rx { /* receive message */ __u64 rx_msgaddr; /* for dma_unmap_single() */ DEFINE_DMA_UNMAP_ADDR(rx_msgunmap); - /* receive work item... */ - struct ib_recv_wr rx_wrq; - /* ...and its memory */ - struct ib_sge rx_sge; }; #define IBLND_POSTRX_DONT_POST 0 /* don't post */ diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index 556dddc..4d5fb67 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -144,7 +144,8 @@ kiblnd_post_rx(struct kib_rx *rx, int credit) { struct kib_conn *conn = rx->rx_conn; struct kib_net *net = conn->ibc_peer->ibp_ni->ni_data; - struct ib_recv_wr *bad_wrq = NULL; + struct ib_recv_wr wrq = {0}; + struct ib_sge rx_sge = {0}; #ifdef HAVE_OFED_IB_GET_DMA_MR struct ib_mr *mr = conn->ibc_hdev->ibh_mrs; #endif @@ -158,17 +159,17 @@ kiblnd_post_rx(struct kib_rx *rx, int credit) #ifdef HAVE_OFED_IB_GET_DMA_MR LASSERT(mr != NULL); - rx->rx_sge.lkey = mr->lkey; + rx_sge.lkey = mr->lkey; #else - rx->rx_sge.lkey = conn->ibc_hdev->ibh_pd->local_dma_lkey; + rx_sge.lkey = conn->ibc_hdev->ibh_pd->local_dma_lkey; #endif - rx->rx_sge.addr = rx->rx_msgaddr; - rx->rx_sge.length = IBLND_MSG_SIZE; + rx_sge.addr = rx->rx_msgaddr; + rx_sge.length = IBLND_MSG_SIZE; - rx->rx_wrq.next = NULL; - rx->rx_wrq.sg_list = &rx->rx_sge; - rx->rx_wrq.num_sge = 1; - rx->rx_wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); + wrq.next = NULL; + wrq.sg_list = &rx_sge; + wrq.num_sge = 1; + wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); LASSERT(conn->ibc_state >= IBLND_CONN_INIT); LASSERT(rx->rx_nob >= 0); /* not posted */ @@ -184,15 +185,10 @@ kiblnd_post_rx(struct kib_rx *rx, int credit) * own this rx (and rx::rx_conn) anymore, LU-5678. */ kiblnd_conn_addref(conn); -#ifdef HAVE_OFED_IB_POST_SEND_RECV_CONST - rc = ib_post_recv(conn->ibc_cmid->qp, &rx->rx_wrq, - (const struct ib_recv_wr **)&bad_wrq); -#else - rc = ib_post_recv(conn->ibc_cmid->qp, &rx->rx_wrq, &bad_wrq); -#endif + rc = ib_post_recv(conn->ibc_cmid->qp, &wrq, NULL); if (unlikely(rc != 0)) { - CERROR("Can't post rx for %s: bad_wrq: %p: rc = %d\n", - libcfs_nidstr(&conn->ibc_peer->ibp_nid), bad_wrq, rc); + CERROR("Can't post rx for %s: rc = %d\n", + libcfs_nidstr(&conn->ibc_peer->ibp_nid), rc); rx->rx_nob = 0; }