From: Sagi Grimberg Date: Tue, 2 Dec 2014 14:57:44 +0000 (+0200) Subject: iser-target: Introduce isert_poll_budget X-Git-Tag: v3.19-rc1~12^2~14 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=37d9fe80a3afc87a3d9f3d83aa0e6137f9fd7cde;p=~emulex%2Finfiniband.git iser-target: Introduce isert_poll_budget In case the CQ is packed with completions, we can't just hog the CPU forever. Poll until a sufficient budget (currently hard-coded to 64k completions) and if budget is exhausted, bailout and give a chance to other threads. Signed-off-by: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index eb3d628ec4d..22841487f60 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -2044,13 +2044,19 @@ isert_handle_wc(struct ib_wc *wc) static void 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; - while (ib_poll_cq(comp->cq, 1, &wc) == 1) + while (ib_poll_cq(comp->cq, 1, &wc) == 1) { isert_handle_wc(&wc); + if (++completed >= isert_poll_budget) + break; + } + ib_req_notify_cq(comp->cq, IB_CQ_NEXT_COMP); }