* [PATCH] IB/cq: Don't process more than the given budget
@ 2017-03-08 20:10 Sagi Grimberg
[not found] ` <1489003801-4410-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2017-03-08 20:10 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Christoph Hellwig
The caller might not want this overhead.
Signed-off-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
---
drivers/infiniband/core/cq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c
index 2746d2eb3d52..c98d15ce2880 100644
--- a/drivers/infiniband/core/cq.c
+++ b/drivers/infiniband/core/cq.c
@@ -29,7 +29,8 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
{
int i, n, completed = 0;
- while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) {
+ while ((n = ib_poll_cq(cq, min(IB_POLL_BATCH, budget - completed),
+ cq->wc)) > 0) {
for (i = 0; i < n; i++) {
struct ib_wc *wc = &cq->wc[i];
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1489003801-4410-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>]
* Re: [PATCH] IB/cq: Don't process more than the given budget [not found] ` <1489003801-4410-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org> @ 2017-03-08 21:36 ` Christoph Hellwig 2017-03-08 22:09 ` Bart Van Assche 1 sibling, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2017-03-08 21:36 UTC (permalink / raw) To: Sagi Grimberg; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Christoph Hellwig On Wed, Mar 08, 2017 at 10:10:01PM +0200, Sagi Grimberg wrote: > The caller might not want this overhead. > > Signed-off-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org> Looks fine, Reviewed-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/cq: Don't process more than the given budget [not found] ` <1489003801-4410-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org> 2017-03-08 21:36 ` Christoph Hellwig @ 2017-03-08 22:09 ` Bart Van Assche [not found] ` <1489010916.2813.4.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Bart Van Assche @ 2017-03-08 22:09 UTC (permalink / raw) To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org Cc: hch-jcswGhMUV9g@public.gmane.org On Wed, 2017-03-08 at 22:10 +0200, Sagi Grimberg wrote: > The caller might not want this overhead. > > Signed-off-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org> > --- > drivers/infiniband/core/cq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c > index 2746d2eb3d52..c98d15ce2880 100644 > --- a/drivers/infiniband/core/cq.c > +++ b/drivers/infiniband/core/cq.c > @@ -29,7 +29,8 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) > { > int i, n, completed = 0; > > - while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { > + while ((n = ib_poll_cq(cq, min(IB_POLL_BATCH, budget - completed), > + cq->wc)) > 0) { > for (i = 0; i < n; i++) { > struct ib_wc *wc = &cq->wc[i]; > This breaks the SRP initiator driver since that driver can pass -1 as budget. Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1489010916.2813.4.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH] IB/cq: Don't process more than the given budget [not found] ` <1489010916.2813.4.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> @ 2017-03-08 22:12 ` hch-jcswGhMUV9g [not found] ` <20170308221227.GA447-jcswGhMUV9g@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: hch-jcswGhMUV9g @ 2017-03-08 22:12 UTC (permalink / raw) To: Bart Van Assche Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org, hch-jcswGhMUV9g@public.gmane.org On Wed, Mar 08, 2017 at 10:09:08PM +0000, Bart Van Assche wrote: > > - while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { > > + while ((n = ib_poll_cq(cq, min(IB_POLL_BATCH, budget - completed), > > + cq->wc)) > 0) { > > for (i = 0; i < n; i++) { > > struct ib_wc *wc = &cq->wc[i]; > > > > This breaks the SRP initiator driver since that driver can pass -1 as budget. Good point, we'd need to special case that. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20170308221227.GA447-jcswGhMUV9g@public.gmane.org>]
* Re: [PATCH] IB/cq: Don't process more than the given budget [not found] ` <20170308221227.GA447-jcswGhMUV9g@public.gmane.org> @ 2017-03-08 22:14 ` Bart Van Assche [not found] ` <1489011263.2813.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Bart Van Assche @ 2017-03-08 22:14 UTC (permalink / raw) To: hch-jcswGhMUV9g@public.gmane.org Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org On Wed, 2017-03-08 at 23:12 +0100, hch-jcswGhMUV9g@public.gmane.org wrote: > On Wed, Mar 08, 2017 at 10:09:08PM +0000, Bart Van Assche wrote: > > > - while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { > > > + while ((n = ib_poll_cq(cq, min(IB_POLL_BATCH, budget - completed), > > > + cq->wc)) > 0) { > > > for (i = 0; i < n; i++) { > > > struct ib_wc *wc = &cq->wc[i]; > > > > > > > This breaks the SRP initiator driver since that driver can pass -1 as budget. > > Good point, we'd need to special case that. How about using min_t(u32, IB_POLL_BATCH, budget - completed)? Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1489011263.2813.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH] IB/cq: Don't process more than the given budget [not found] ` <1489011263.2813.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> @ 2017-03-08 22:59 ` Sagi Grimberg 0 siblings, 0 replies; 6+ messages in thread From: Sagi Grimberg @ 2017-03-08 22:59 UTC (permalink / raw) To: Bart Van Assche, hch-jcswGhMUV9g@public.gmane.org Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >>>> - while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { >>>> + while ((n = ib_poll_cq(cq, min(IB_POLL_BATCH, budget - completed), >>>> + cq->wc)) > 0) { >>>> for (i = 0; i < n; i++) { >>>> struct ib_wc *wc = &cq->wc[i]; >>>> >>> >>> This breaks the SRP initiator driver since that driver can pass -1 as budget. >> >> Good point, we'd need to special case that. > > How about using min_t(u32, IB_POLL_BATCH, budget - completed)? Yep, I'll do that, thanks Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-08 22:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 20:10 [PATCH] IB/cq: Don't process more than the given budget Sagi Grimberg
[not found] ` <1489003801-4410-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-03-08 21:36 ` Christoph Hellwig
2017-03-08 22:09 ` Bart Van Assche
[not found] ` <1489010916.2813.4.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-03-08 22:12 ` hch-jcswGhMUV9g
[not found] ` <20170308221227.GA447-jcswGhMUV9g@public.gmane.org>
2017-03-08 22:14 ` Bart Van Assche
[not found] ` <1489011263.2813.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-03-08 22:59 ` Sagi Grimberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox