From 1ef1fa06b20c424f56ed535231bc0452b32a5609 Mon Sep 17 00:00:00 2001 From: Ian Ziemba Date: Thu, 23 Jun 2022 16:30:37 -0500 Subject: [PATCH] LU-16078 o2iblnd: Salt comp_vector If conns_per_peer is greater than 1, all the connections targeting the same peer are assigned the same comp_vector. This results in multiple IB CQs targeting the same peer to be serialized on a single comp_vector. Help spread out the IB CQ work to multiple cores by salting comp_vector based on number of connections. 1 client to 1 server LST 1M write results with 4 conns_per_peer and RXE configured to spread out work based on comp_vector. Before: 1377.92 MB/s After: 3828.48 MB/s Test-Parameters: trivial HPE-bug-id: LUS-11043 Change-Id: I4e3e2056947ee54d6d65f17e238163c9dc38cd61 Signed-off-by: Ian Ziemba Reviewed-on: https://review.whamcloud.com/48148 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/klnds/o2iblnd/o2iblnd.c | 11 +++++++++-- lnet/klnds/o2iblnd/o2iblnd.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index 9c9d251..7f882b0 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -339,6 +339,7 @@ kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, peer_ni->ibp_queue_depth = ni->ni_net->net_tunables.lct_peer_tx_credits; peer_ni->ibp_queue_depth_mod = 0; /* try to use the default */ kref_init(&peer_ni->ibp_kref); + atomic_set(&peer_ni->ibp_nconns, 0); INIT_HLIST_NODE(&peer_ni->ibp_list); INIT_LIST_HEAD(&peer_ni->ibp_conns); @@ -650,8 +651,12 @@ kiblnd_get_completion_vector(struct kib_conn *conn, int cpt) mask = cfs_cpt_cpumask(lnet_cpt_table(), cpt); - /* hash NID to CPU id in this partition... */ - ibp_nid = conn->ibc_peer->ibp_nid; + /* hash NID to CPU id in this partition... when targeting a single peer + * with multiple QPs, to engage more cores in CQ processing to a single + * peer, use ibp_nconns to salt the value the comp_vector value + */ + ibp_nid = conn->ibc_peer->ibp_nid + + atomic_read(&conn->ibc_peer->ibp_nconns); off = do_div(ibp_nid, cpumask_weight(*mask)); for_each_cpu(i, *mask) { if (off-- == 0) @@ -964,6 +969,7 @@ kiblnd_create_conn(struct kib_peer_ni *peer_ni, struct rdma_cm_id *cmid, conn->ibc_state = state; /* 1 more conn */ + atomic_inc(&peer_ni->ibp_nconns); atomic_inc(&net->ibn_nconns); return conn; @@ -1033,6 +1039,7 @@ kiblnd_destroy_conn(struct kib_conn *conn) kiblnd_peer_decref(peer_ni); rdma_destroy_id(cmid); + atomic_dec(&peer_ni->ibp_nconns); atomic_dec(&net->ibn_nconns); } } diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 4c8581d..0a8547d 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -688,6 +688,8 @@ struct kib_peer_ni { __u16 ibp_queue_depth; /* reduced value which allows conn to be created if max fails */ __u16 ibp_queue_depth_mod; + /* Number of connections allocated. */ + atomic_t ibp_nconns; }; #ifndef HAVE_IB_INC_RKEY -- 1.8.3.1