Received: by 10.223.185.116 with SMTP id b49csp1033955wrg; Wed, 21 Feb 2018 10:56:03 -0800 (PST) X-Google-Smtp-Source: AH8x2249H4CJafdxe4UtIlXJTUXSXEB6I7w/1pDtW4BJ3x2+j+H2HPZVN0DPFIWDlC/I8AaGmYY8 X-Received: by 10.167.131.88 with SMTP id z24mr2537616pfm.86.1519239362928; Wed, 21 Feb 2018 10:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239362; cv=none; d=google.com; s=arc-20160816; b=bMxMxlMFlZTzEHAQ8cskVHHzOVwckelel7bAtSLM4zunWgkao+UtVPeW8Y2DiBAZ13 gudWJ2Gxi2BcL8F2SSvjBv50yxzz6yx6Hp2Q1IANkhRoFsiNpv0g5jezDo0qlqFuV5df v3JDHSPbTwT7cwjdAfWpf+SpxJAjYGwcGuz6Qd/BQK08fvF6WIh+tWuwxnp1tv1AB1Ay FUX5N+DhHDGlfbrlY3F7rvKKA6JPTZiXzwJYkdVs9PCut3sE2Hb2WV9h0HQWdamG8rbW lTW+hchQVrZ3GxqdZyZ8Zl7GCjkYDtcvJ6RMX5WPmkVdymZCaLkE37qpzNrsAa+FBPyf /S8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=GhGz+xu1+17Vzzll0Hh080b3tGt1C/e2hNTLKNL7qRY=; b=MgXs6mpPefYYTfYAAYUiJs871IyiDNpxiGkpfhoe3k4rqrBGUhDDnChxYWGHIY4Hwi 3aGdMremGwdtCc9wO++i3XoRRbwr6xPkRE6Q+ramiGjFR2+lf2jFIk7YMzX0M2VZGLcl C+PWtYguzu1A5XuF4ly6tWirVi+WNY7c8sptI9pGXC8sRrzDZGF9CyXuyrLhKEzi1TkP 9wTh0YeUJNqd1RJBMd9WHSAPReCzdBhMGn1t5kaGpjbSvESFdELWHU5iKtdS88huOd+i d7sgFbrPjxL9FTzQi7WUel6fFf5qI/k9EQulbUmgS3XBEc8lxpjwJIwDB2o00u+Ut4oX Kl4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=JYlBjiKJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si858924pga.394.2018.02.21.10.55.48; Wed, 21 Feb 2018 10:56:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=JYlBjiKJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754686AbeBUPKy (ORCPT + 99 others); Wed, 21 Feb 2018 10:10:54 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:38172 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbeBUPKv (ORCPT ); Wed, 21 Feb 2018 10:10:51 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1LF7OIL056141; Wed, 21 Feb 2018 15:10:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2017-10-26; bh=GhGz+xu1+17Vzzll0Hh080b3tGt1C/e2hNTLKNL7qRY=; b=JYlBjiKJu9FGievJGktD8xYKRbrhePeDMbGy1pR2H3US6A+LKFSwTasRalPkYFwrBI1l yXTx+ZleVW6Cp+p768cbRb0hGQhmLVHbLVJWzL07zIldjA+1If6eQWruO8lemRlWFK5r 5j7G/sw0EIe6GtyfiN5S4qGlvFOdZLwkuRmOPuKL/wcRayhYJD9Yios9s90AwzyPLfn7 G3iraAivLj5BJ+ESuZF3at3tuUblT38cOQHCcjnYzYjHUhy7Oc3i3hsFSlhbUKIBFZEa /AoiNMUD/25doVQrybHOpctYbAMfCvQ+WH8ZJ3DNZDOnZPGmGiRU5hXN2fQTNc+1a91k LQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2g98adrx2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Feb 2018 15:10:34 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1LFAXF5007609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Feb 2018 15:10:33 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1LFAVPP023603; Wed, 21 Feb 2018 15:10:31 GMT Received: from anon-dhcp-171.1015granger.net (/68.61.232.219) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 21 Feb 2018 07:10:31 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: [PATCH] RDMA/core: reduce IB_POLL_BATCH constant From: Chuck Lever In-Reply-To: Date: Wed, 21 Feb 2018 10:10:27 -0500 Cc: Bart Van Assche , "jgg@ziepe.ca" , "arnd@arndb.de" , "dledford@redhat.com" , "linux-kernel@vger.kernel.org" , "leonro@mellanox.com" , "linux-rdma@vger.kernel.org" Content-Transfer-Encoding: quoted-printable Message-Id: <361D2F0F-F03C-438D-9C90-D6ABD0CAC12B@oracle.com> References: <20180220205924.2035765-1-arnd@arndb.de> <1519161268.3737.12.camel@wdc.com> To: Sagi Grimberg X-Mailer: Apple Mail (2.3445.5.20) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8810 signatures=668675 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=925 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802210184 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 21, 2018, at 8:44 AM, Sagi Grimberg wrote: >=20 >=20 >>> On Tue, 2018-02-20 at 21:59 +0100, Arnd Bergmann wrote: >>>> /* # of WCs to poll for with a single call to ib_poll_cq */ >>>> -#define IB_POLL_BATCH 16 >>>> +#define IB_POLL_BATCH 8 >>>=20 >>> The purpose of batch polling is to minimize contention on the cq = spinlock. >>> Reducing the IB_POLL_BATCH constant may affect performance = negatively. Has >>> the performance impact of this change been verified for all affected = drivers >>> (ib_srp, ib_srpt, ib_iser, ib_isert, NVMeOF, NVMeOF target, SMB = Direct, NFS >>> over RDMA, ...)? >> Only the users of the DIRECT polling method use an on-stack >> array of ib_wc's. This is only the SRP drivers. >> The other two modes have use of a dynamically allocated array >> of ib_wc's that hangs off the ib_cq. These shouldn't need any >> reduction in the size of this array, and they are the common >> case. >> IMO a better solution would be to change ib_process_cq_direct >> to use a smaller on-stack array, and leave IB_POLL_BATCH alone. >=20 > The only reason why I added this array on-stack was to allow consumers > that did not use ib_alloc_cq api to call it, but that seems like a > wrong decision when thinking it over again (as probably these users > did not set the wr_cqe correctly). >=20 > How about we make ib_process_cq_direct use the cq wc array and add > a WARN_ON statement (and fail it gracefully) if the caller used this > API without calling ib_alloc_cq? Agreed, I prefer that all three modes use dynamically allocated memory for that array. > -- > diff --git a/drivers/infiniband/core/cq.c = b/drivers/infiniband/core/cq.c > index bc79ca8215d7..cd3e9e124834 100644 > --- a/drivers/infiniband/core/cq.c > +++ b/drivers/infiniband/core/cq.c > @@ -25,10 +25,10 @@ > #define IB_POLL_FLAGS \ > (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) >=20 > -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) > { > int i, n, completed =3D 0; > - struct ib_wc *wcs =3D poll_wc ? : cq->wc; > + struct ib_wc *wcs =3D cq->wc; >=20 > /* > * budget might be (-1) if the caller does not > @@ -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) > { > - struct ib_wc wcs[IB_POLL_BATCH]; > - > - return __ib_process_cq(cq, budget, wcs); > + if (unlikely(WARN_ON_ONCE(!cq->wc))) > + return 0; > + return __ib_process_cq(cq, budget); > } > EXPORT_SYMBOL(ib_process_cq_direct); >=20 > @@ -88,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int = budget) > struct ib_cq *cq =3D container_of(iop, struct ib_cq, iop); > int completed; >=20 > - completed =3D __ib_process_cq(cq, budget, NULL); > + completed =3D __ib_process_cq(cq, budget); > if (completed < budget) { > irq_poll_complete(&cq->iop); > if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) > @@ -108,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct = *work) > struct ib_cq *cq =3D container_of(work, struct ib_cq, work); > int completed; >=20 > - completed =3D __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, = NULL); > + completed =3D __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE); > if (completed >=3D IB_POLL_BUDGET_WORKQUEUE || > ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) > queue_work(ib_comp_wq, &cq->work); > -- -- Chuck Lever