[PATCH v4 29/35] iser-target: Reduce CQ lock contention by batch polling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to reduce the contention on CQ locking (present
in some LLDDs) we poll in batches of 16 work completion items.

Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx>
---
 drivers/infiniband/ulp/isert/ib_isert.c |   12 +++++++-----
 drivers/infiniband/ulp/isert/ib_isert.h |    2 ++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 2284148..276054b 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -2047,13 +2047,15 @@ isert_cq_work(struct work_struct *work)
 	enum { isert_poll_budget = 65536 };
 	struct isert_comp *comp = container_of(work, struct isert_comp,
 					       work);
-	int completed = 0;
-	struct ib_wc wc;
+	struct ib_wc *const wcs = comp->wcs;
+	int i, n, completed = 0;
 
-	while (ib_poll_cq(comp->cq, 1, &wc) == 1) {
-		isert_handle_wc(&wc);
+	while ((n = ib_poll_cq(comp->cq, ARRAY_SIZE(comp->wcs), wcs)) > 0) {
+		for (i = 0; i < n; i++)
+			isert_handle_wc(&wcs[i]);
 
-		if (++completed >= isert_poll_budget)
+		completed += n;
+		if (completed >= isert_poll_budget)
 			break;
 	}
 
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index fc1d323..2a0721f 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -165,6 +165,7 @@ struct isert_conn {
  *
  * @device:     pointer to device handle
  * @cq:         completion queue
+ * @wcs:        work completion array
  * @active_qps: Number of active QPs attached
  *              to completion context
  * @work:       completion work handle
@@ -172,6 +173,7 @@ struct isert_conn {
 struct isert_comp {
 	struct isert_device     *device;
 	struct ib_cq		*cq;
+	struct ib_wc		 wcs[16];
 	int                      active_qps;
 	struct work_struct	 work;
 };
-- 
1.7.1

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




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux