Skip to content

Commit 5601245

Browse files
RDS: IB: split the mr registration and invalidation path
MR invalidation in RDS is done in background thread and not in data path like registration. So break the dependency between them which helps to remove the performance bottleneck. Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
1 parent 584a827 commit 5601245

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

net/rds/ib.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
#define RDS_IB_DEFAULT_RECV_WR 1024
1616
#define RDS_IB_DEFAULT_SEND_WR 256
17-
#define RDS_IB_DEFAULT_FR_WR 512
17+
#define RDS_IB_DEFAULT_FR_WR 256
18+
#define RDS_IB_DEFAULT_FR_INV_WR 256
1819

1920
#define RDS_IB_DEFAULT_RETRY_COUNT 1
2021

@@ -125,6 +126,7 @@ struct rds_ib_connection {
125126

126127
/* To control the number of wrs from fastreg */
127128
atomic_t i_fastreg_wrs;
129+
atomic_t i_fastunreg_wrs;
128130

129131
/* interrupt handling */
130132
struct tasklet_struct i_send_tasklet;

net/rds/ib_cm.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
382382
* completion queue and send queue. This extra space is used for FRMR
383383
* registration and invalidation work requests
384384
*/
385-
fr_queue_space = (rds_ibdev->use_fastreg ? RDS_IB_DEFAULT_FR_WR : 0);
385+
fr_queue_space = rds_ibdev->use_fastreg ?
386+
(RDS_IB_DEFAULT_FR_WR + 1) +
387+
(RDS_IB_DEFAULT_FR_INV_WR + 1)
388+
: 0;
386389

387390
/* add the conn now so that connection establishment has the dev */
388391
rds_ib_add_conn(rds_ibdev, conn);
@@ -444,6 +447,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
444447
attr.send_cq = ic->i_send_cq;
445448
attr.recv_cq = ic->i_recv_cq;
446449
atomic_set(&ic->i_fastreg_wrs, RDS_IB_DEFAULT_FR_WR);
450+
atomic_set(&ic->i_fastunreg_wrs, RDS_IB_DEFAULT_FR_INV_WR);
447451

448452
/*
449453
* XXX this can fail if max_*_wr is too large? Are we supposed
@@ -766,7 +770,8 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
766770
wait_event(rds_ib_ring_empty_wait,
767771
rds_ib_ring_empty(&ic->i_recv_ring) &&
768772
(atomic_read(&ic->i_signaled_sends) == 0) &&
769-
(atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR));
773+
(atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR) &&
774+
(atomic_read(&ic->i_fastunreg_wrs) == RDS_IB_DEFAULT_FR_INV_WR));
770775
tasklet_kill(&ic->i_send_tasklet);
771776
tasklet_kill(&ic->i_recv_tasklet);
772777

net/rds/ib_frmr.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ static int rds_ib_post_inv(struct rds_ib_mr *ibmr)
241241
if (frmr->fr_state != FRMR_IS_INUSE)
242242
goto out;
243243

244-
while (atomic_dec_return(&ibmr->ic->i_fastreg_wrs) <= 0) {
245-
atomic_inc(&ibmr->ic->i_fastreg_wrs);
244+
while (atomic_dec_return(&ibmr->ic->i_fastunreg_wrs) <= 0) {
245+
atomic_inc(&ibmr->ic->i_fastunreg_wrs);
246246
cpu_relax();
247247
}
248248

@@ -261,7 +261,7 @@ static int rds_ib_post_inv(struct rds_ib_mr *ibmr)
261261
if (unlikely(ret)) {
262262
frmr->fr_state = FRMR_IS_STALE;
263263
frmr->fr_inv = false;
264-
atomic_inc(&ibmr->ic->i_fastreg_wrs);
264+
atomic_inc(&ibmr->ic->i_fastunreg_wrs);
265265
pr_err("RDS/IB: %s returned error(%d)\n", __func__, ret);
266266
goto out;
267267
}
@@ -289,9 +289,10 @@ void rds_ib_mr_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc)
289289
if (frmr->fr_inv) {
290290
frmr->fr_state = FRMR_IS_FREE;
291291
frmr->fr_inv = false;
292+
atomic_inc(&ic->i_fastreg_wrs);
293+
} else {
294+
atomic_inc(&ic->i_fastunreg_wrs);
292295
}
293-
294-
atomic_inc(&ic->i_fastreg_wrs);
295296
}
296297

297298
void rds_ib_unreg_frmr(struct list_head *list, unsigned int *nfreed,

0 commit comments

Comments
 (0)