Commit 36ea63b5 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

iser-target: Reduce CQ lock contention by batch polling

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: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 37d9fe80
...@@ -2047,13 +2047,15 @@ isert_cq_work(struct work_struct *work) ...@@ -2047,13 +2047,15 @@ isert_cq_work(struct work_struct *work)
enum { isert_poll_budget = 65536 }; enum { isert_poll_budget = 65536 };
struct isert_comp *comp = container_of(work, struct isert_comp, struct isert_comp *comp = container_of(work, struct isert_comp,
work); work);
int completed = 0; struct ib_wc *const wcs = comp->wcs;
struct ib_wc wc; int i, n, completed = 0;
while (ib_poll_cq(comp->cq, 1, &wc) == 1) { while ((n = ib_poll_cq(comp->cq, ARRAY_SIZE(comp->wcs), wcs)) > 0) {
isert_handle_wc(&wc); for (i = 0; i < n; i++)
isert_handle_wc(&wcs[i]);
if (++completed >= isert_poll_budget) completed += n;
if (completed >= isert_poll_budget)
break; break;
} }
......
...@@ -165,6 +165,7 @@ struct isert_conn { ...@@ -165,6 +165,7 @@ struct isert_conn {
* *
* @device: pointer to device handle * @device: pointer to device handle
* @cq: completion queue * @cq: completion queue
* @wcs: work completion array
* @active_qps: Number of active QPs attached * @active_qps: Number of active QPs attached
* to completion context * to completion context
* @work: completion work handle * @work: completion work handle
...@@ -172,6 +173,7 @@ struct isert_conn { ...@@ -172,6 +173,7 @@ struct isert_conn {
struct isert_comp { struct isert_comp {
struct isert_device *device; struct isert_device *device;
struct ib_cq *cq; struct ib_cq *cq;
struct ib_wc wcs[16];
int active_qps; int active_qps;
struct work_struct work; struct work_struct work;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment