RDMA/core: Reduce poll batch for direct cq polling
Fix warning limit for kernel stack consumption:
drivers/infiniband/core/cq.c: In function 'ib_process_cq_direct':
drivers/infiniband/core/cq.c:78:1: error: the frame size of 1032 bytes
is larger than 1024 bytes [-Werror=frame-larger-than=]
Using smaller ib_wc array on the stack brings us comfortably below that
limit again.
Fixes: 246d8b184c
("IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sergey Gorenko <sergeygo@mellanox.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
5d414b178e
commit
d3b9e8ad42
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
/* # of WCs to poll for with a single call to ib_poll_cq */
|
/* # of WCs to poll for with a single call to ib_poll_cq */
|
||||||
#define IB_POLL_BATCH 16
|
#define IB_POLL_BATCH 16
|
||||||
|
#define IB_POLL_BATCH_DIRECT 8
|
||||||
|
|
||||||
/* # of WCs to iterate over before yielding */
|
/* # of WCs to iterate over before yielding */
|
||||||
#define IB_POLL_BUDGET_IRQ 256
|
#define IB_POLL_BUDGET_IRQ 256
|
||||||
|
@ -25,18 +26,18 @@
|
||||||
#define IB_POLL_FLAGS \
|
#define IB_POLL_FLAGS \
|
||||||
(IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
|
(IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
|
||||||
|
|
||||||
static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
|
static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *wcs,
|
||||||
|
int batch)
|
||||||
{
|
{
|
||||||
int i, n, completed = 0;
|
int i, n, completed = 0;
|
||||||
struct ib_wc *wcs = poll_wc ? : cq->wc;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* budget might be (-1) if the caller does not
|
* budget might be (-1) if the caller does not
|
||||||
* want to bound this call, thus we need unsigned
|
* want to bound this call, thus we need unsigned
|
||||||
* minimum here.
|
* minimum here.
|
||||||
*/
|
*/
|
||||||
while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
|
while ((n = ib_poll_cq(cq, min_t(u32, batch,
|
||||||
budget - completed), wcs)) > 0) {
|
budget - completed), wcs)) > 0) {
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
struct ib_wc *wc = &wcs[i];
|
struct ib_wc *wc = &wcs[i];
|
||||||
|
|
||||||
|
@ -48,8 +49,7 @@ static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
|
||||||
|
|
||||||
completed += n;
|
completed += n;
|
||||||
|
|
||||||
if (n != IB_POLL_BATCH ||
|
if (n != batch || (budget != -1 && completed >= budget))
|
||||||
(budget != -1 && completed >= budget))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,9 +72,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
|
||||||
*/
|
*/
|
||||||
int ib_process_cq_direct(struct ib_cq *cq, int budget)
|
int ib_process_cq_direct(struct ib_cq *cq, int budget)
|
||||||
{
|
{
|
||||||
struct ib_wc wcs[IB_POLL_BATCH];
|
struct ib_wc wcs[IB_POLL_BATCH_DIRECT];
|
||||||
|
|
||||||
return __ib_process_cq(cq, budget, wcs);
|
return __ib_process_cq(cq, budget, wcs, IB_POLL_BATCH_DIRECT);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ib_process_cq_direct);
|
EXPORT_SYMBOL(ib_process_cq_direct);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget)
|
||||||
struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
|
struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
|
||||||
int completed;
|
int completed;
|
||||||
|
|
||||||
completed = __ib_process_cq(cq, budget, NULL);
|
completed = __ib_process_cq(cq, budget, cq->wc, IB_POLL_BATCH);
|
||||||
if (completed < budget) {
|
if (completed < budget) {
|
||||||
irq_poll_complete(&cq->iop);
|
irq_poll_complete(&cq->iop);
|
||||||
if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
|
if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
|
||||||
|
@ -108,7 +108,8 @@ static void ib_cq_poll_work(struct work_struct *work)
|
||||||
struct ib_cq *cq = container_of(work, struct ib_cq, work);
|
struct ib_cq *cq = container_of(work, struct ib_cq, work);
|
||||||
int completed;
|
int completed;
|
||||||
|
|
||||||
completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
|
completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, cq->wc,
|
||||||
|
IB_POLL_BATCH);
|
||||||
if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
|
if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
|
||||||
ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
|
ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
|
||||||
queue_work(ib_comp_wq, &cq->work);
|
queue_work(ib_comp_wq, &cq->work);
|
||||||
|
|
Loading…
Reference in New Issue