IB/mad: Ensure fairness in ib_mad_completion_handler
authorDean Luick <dean.luick@intel.com>
Thu, 10 Dec 2015 21:52:30 +0000 (16:52 -0500)
committerDoug Ledford <dledford@redhat.com>
Thu, 24 Dec 2015 05:17:30 +0000 (00:17 -0500)
commit0d6ed314de18b65a8063cbed450a2ca0c6a16c52
treeefb33d2fc3f4d828f9890d029e4d84261af17897
parent051f263098a90d208e2d20251bfd4834bc783214
IB/mad: Ensure fairness in ib_mad_completion_handler

It was found that when a process was rapidly sending MADs other processes could
be hung in their unregister calls.

This would happen when process A was injecting packets fast enough that the
single threaded workqueue was never exiting ib_mad_completion_handler.
Therefore when process B called flush_workqueue via the unregister call it
would hang until process A stopped sending MADs.

The fix is to periodically reschedule ib_mad_completion_handler after
processing a large number of completions.  The number of completions chosen was
decided based on the defaults for the recv queue size.  However, it was kept
fixed such that increasing those queue sizes would not adversely affect
fairness in the future.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/mad.c