summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/hfi1/ruc.c
diff options
context:
space:
mode:
authorDean Luick2015-10-26 15:28:35 +0100
committerGreg Kroah-Hartman2015-10-27 09:19:22 +0100
commitb421922e66db43ffccb28a7df7c44263a917ba63 (patch)
treecce4e8cb44446bb9a23100e53a2caf69dbde66f7 /drivers/staging/rdma/hfi1/ruc.c
parentstaging/rdma/hfi1: Reset firmware instead of reloading Sbus (diff)
downloadkernel-qcow2-linux-b421922e66db43ffccb28a7df7c44263a917ba63.tar.gz
kernel-qcow2-linux-b421922e66db43ffccb28a7df7c44263a917ba63.tar.xz
kernel-qcow2-linux-b421922e66db43ffccb28a7df7c44263a917ba63.zip
staging/rdma/hfi1: Add a schedule in send thread
When under heavy load, the send handler can run too long without allowing other tasks to run. Add a conditional resched to break this up. Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rdma/hfi1/ruc.c')
-rw-r--r--drivers/staging/rdma/hfi1/ruc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c
index faad1b93703e..8614b070545c 100644
--- a/drivers/staging/rdma/hfi1/ruc.c
+++ b/drivers/staging/rdma/hfi1/ruc.c
@@ -820,6 +820,9 @@ void hfi1_make_ruc_header(struct hfi1_qp *qp, struct hfi1_other_headers *ohdr,
ohdr->bth[2] = cpu_to_be32(bth2);
}
+/* when sending, force a reschedule every one of these periods */
+#define SEND_RESCHED_TIMEOUT (5 * HZ) /* 5s in jiffies */
+
/**
* hfi1_do_send - perform a send on a QP
* @work: contains a pointer to the QP
@@ -836,6 +839,7 @@ void hfi1_do_send(struct work_struct *work)
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
int (*make_req)(struct hfi1_qp *qp);
unsigned long flags;
+ unsigned long timeout;
if ((qp->ibqp.qp_type == IB_QPT_RC ||
qp->ibqp.qp_type == IB_QPT_UC) &&
@@ -864,6 +868,7 @@ void hfi1_do_send(struct work_struct *work)
spin_unlock_irqrestore(&qp->s_lock, flags);
+ timeout = jiffies + SEND_RESCHED_TIMEOUT;
do {
/* Check for a constructed packet to be sent. */
if (qp->s_hdrwords != 0) {
@@ -877,6 +882,13 @@ void hfi1_do_send(struct work_struct *work)
/* Record that s_hdr is empty. */
qp->s_hdrwords = 0;
}
+
+ /* allow other tasks to run */
+ if (unlikely(time_after(jiffies, timeout))) {
+ cond_resched();
+ ppd->dd->verbs_dev.n_send_schedule++;
+ timeout = jiffies + SEND_RESCHED_TIMEOUT;
+ }
} while (make_req(qp));
}