diff mbox

[v3,4/4] rsockets: acknowledge completion queue events in batch

Message ID c34f0dcd116683c05c7c1836c381a09f@imap.linux.ibm.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sreedhar Kodali Sept. 8, 2014, 12:51 p.m. UTC
Author: Sreedhar Kodali <srkodali@linux.vnet.ibm.com>
Change note from v2 to v3: eliminated setting through option as 
suggested by Sean
Date:   Mon Sep 8 15:38:54 2014 +0530

     Perform completion event acknowledgments in batches instead
     of individually to minimze locking overheads.  Size of the
     completion queue decides the size of a batch.

     Signed-off-by: Sreedhar Kodali <srkodali@linux.vnet.ibm.com>
     ---

  	fastlock_init(&rs->cq_lock);
@@ -1044,8 +1046,11 @@ static void rs_free(struct rsocket *rs)

  	if (rs->cm_id) {
  		rs_free_iomappings(rs);
-		if (rs->cm_id->qp)
+		if (rs->cm_id->qp) {
+			if (rs->unack_cqe > 0)
+				ibv_ack_cq_events(rs->cm_id->recv_cq, rs->unack_cqe);
  			rdma_destroy_qp(rs->cm_id);
+		}
  		rdma_destroy_id(rs->cm_id);
  	}

@@ -2026,7 +2031,11 @@ static int rs_get_cq_event(struct rsocket *rs)
  resume_get_cq_event:
  	ret = ibv_get_cq_event(rs->cm_id->recv_cq_channel, &cq, &context);
  	if (!ret) {
-		ibv_ack_cq_events(rs->cm_id->recv_cq, 1);
+		rs->unack_cqe += 1;
+		if (rs->unack_cqe == rs->sq_size + rs->rq_size) {
+			ibv_ack_cq_events(rs->cm_id->recv_cq, rs->unack_cqe);
+			rs->unack_cqe = 0;
+		}
  		rs->cq_armed = 0;
  	} else if (restart_onintr == 1 && errno == EINTR) {
  		errno = 0;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Hefty, Sean Sept. 17, 2014, 4:21 p.m. UTC | #1
Can you please resend this patch as well?  There's something off with the formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreedhar Kodali Sept. 18, 2014, 10:55 a.m. UTC | #2
On 2014-09-17 21:51, Hefty, Sean wrote:
> Can you please resend this patch as well?  There's something off with
> the formatting.

Hi Sean,

I have resent the patch in v5.  Also attached the patch file to message
for convenience.

Thank You.

- Sreedhar

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/rsocket.c b/src/rsocket.c
index ffea0ca..d201e0a 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -384,6 +384,7 @@  struct rsocket {
  	dlist_entry	  iomap_list;
  	dlist_entry	  iomap_queue;
  	int		  iomap_pending;
+	int	      unack_cqe;
  };

  #define DS_UDP_TAG 0x55555555
@@ -638,6 +639,7 @@  static struct rsocket *rs_alloc(struct rsocket 
*inherited_rs, int type)
  			rs->target_iomap_size = def_iomap_size;
  		}
  	}
+	rs->unack_cqe = 0;
  	fastlock_init(&rs->slock);
  	fastlock_init(&rs->rlock);