From patchwork Wed Mar 8 20:10:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9611875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A74A60414 for ; Wed, 8 Mar 2017 20:10:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC6A285EE for ; Wed, 8 Mar 2017 20:10:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40B4628624; Wed, 8 Mar 2017 20:10:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B508E285EE for ; Wed, 8 Mar 2017 20:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751906AbdCHUKV (ORCPT ); Wed, 8 Mar 2017 15:10:21 -0500 Received: from merlin.infradead.org ([205.233.59.134]:44966 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753795AbdCHUKT (ORCPT ); Wed, 8 Mar 2017 15:10:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WtmbIs9+OXR37luf4CckRdsgSavSq6XhqLguLbqxcm8=; b=noLI3pV+D3ahfJE0igjgmidjj p/gRObWhDi/DGy+v0TbUitvP273SZKyE8U+GupqTCvg4OTULkrofk5OkxGBEtAi+ZOHtaNGc3IYfN NK6K1/goea9UzOOmZtFKPdbe6XEj6yiM7wfiCPHSgcBfM1v8YOIY+U5wmAXNPLHePztHoaahG4exR gmDBHXLjFmCAhJrB9fObxyA3lXvp1S4Y1XIJ8E/weENjQ3eG9kDAD/GztljKE3KLtIZhgm3tX/DKK E5uG5pNhZ/ttj9oRbaAem+iMxVueAYegq2bpGq0HWpCC9CgJlxckK/lozcSUzJqePX2fCX2ecxUER 9i0feAAPw==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1clhuO-00056K-Pw; Wed, 08 Mar 2017 20:10:05 +0000 From: Sagi Grimberg To: linux-rdma@vger.kernel.org Cc: Christoph Hellwig Subject: [PATCH] IB/cq: Don't process more than the given budget Date: Wed, 8 Mar 2017 22:10:01 +0200 Message-Id: <1489003801-4410-1-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The caller might not want this overhead. Signed-off-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- 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];