Skip to content

Commit ba10405

Browse files
Vu Phamgregkh
authored andcommitted
iser-target: Avoid using FRMR for single dma entry requests
commit f01b9f7 upstream. This patch changes isert_reg_rdma_frwr() to not use FRMR for single dma entry requests from small I/Os, in order to avoid the associated memory registration overhead. Using DMA MR is sufficient here for the single dma entry requests, and addresses a >= v3.12 performance regression. Signed-off-by: Vu Pham <vu@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a009902 commit ba10405

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

‎drivers/infiniband/ulp/isert/ib_isert.c‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,18 +2259,26 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
22592259
data_len = min(data_left, rdma_write_max);
22602260
wr->cur_rdma_length = data_len;
22612261

2262-
spin_lock_irqsave(&isert_conn->conn_lock, flags);
2263-
fr_desc = list_first_entry(&isert_conn->conn_frwr_pool,
2264-
struct fast_reg_descriptor, list);
2265-
list_del(&fr_desc->list);
2266-
spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
2267-
wr->fr_desc = fr_desc;
2268-
2269-
ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn,
2270-
ib_sge, offset, data_len);
2271-
if (ret) {
2272-
list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool);
2273-
goto unmap_sg;
2262+
/* if there is a single dma entry, dma mr is sufficient */
2263+
if (count == 1) {
2264+
ib_sge->addr = ib_sg_dma_address(ib_dev, &sg_start[0]);
2265+
ib_sge->length = ib_sg_dma_len(ib_dev, &sg_start[0]);
2266+
ib_sge->lkey = isert_conn->conn_mr->lkey;
2267+
wr->fr_desc = NULL;
2268+
} else {
2269+
spin_lock_irqsave(&isert_conn->conn_lock, flags);
2270+
fr_desc = list_first_entry(&isert_conn->conn_frwr_pool,
2271+
struct fast_reg_descriptor, list);
2272+
list_del(&fr_desc->list);
2273+
spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
2274+
wr->fr_desc = fr_desc;
2275+
2276+
ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn,
2277+
ib_sge, offset, data_len);
2278+
if (ret) {
2279+
list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool);
2280+
goto unmap_sg;
2281+
}
22742282
}
22752283

22762284
return 0;

0 commit comments

Comments
 (0)