From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28138C56201 for ; Thu, 19 Nov 2020 21:05:52 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E590221F1 for ; Thu, 19 Nov 2020 21:05:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oBLrg6zL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E590221F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CcXJq6S5hzDqDc for ; Fri, 20 Nov 2020 08:05:47 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=tlfalcon@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=oBLrg6zL; dkim-atps=neutral Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CcX8t5bgHzDqtt; Fri, 20 Nov 2020 07:58:54 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AJKZLwi038704; Thu, 19 Nov 2020 15:58:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=qJDY2PTYw/PLiBcP6m0c8IB+46oc0gqj3Qvg/Ep0U9U=; b=oBLrg6zLsdsTWW3386/ZXjP3urYCMSN/F/Zt+CN/L+sVtbrkuTiUtY77oKAE1iJQQqWk gPJDr1JicbA14oh6xdVpYx10esGd/iEvB8cajLjz3pbP2pLVvQfvX9XngXcICqHPYXOk xKWMtkk9jQb/u/z/+JTzvcEwrq/UxjFXutA377mBmcCSGxB6zfj/XIyFEuVsEyWDrW35 RXe8GJbQ8cX6aRheLqb8Cd1SraWs7pY5jAI7By5A/AF/q40NfJ7jDU/sJ8tkNMRzff4R 56hwQQ35pouqNZDMF1oBw88kH94X/cprF2ypmO/NoFOj7nAwbEtrRaApxsG2xUfEu9mN xA== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 34wy6fskxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Nov 2020 15:58:49 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AJKpFiH013630; Thu, 19 Nov 2020 20:58:48 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma01wdc.us.ibm.com with ESMTP id 34uyn1qusn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Nov 2020 20:58:48 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AJKwm8G54591882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Nov 2020 20:58:48 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17573124055; Thu, 19 Nov 2020 20:58:48 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 486B3124052; Thu, 19 Nov 2020 20:58:47 +0000 (GMT) Received: from oc7186267434.ibm.com (unknown [9.65.227.245]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 19 Nov 2020 20:58:47 +0000 (GMT) Subject: Re: [PATCH net-next v2 9/9] ibmvnic: Do not replenish RX buffers after every polling loop To: ljp References: <1605748345-32062-1-git-send-email-tlfalcon@linux.ibm.com> <1605748345-32062-10-git-send-email-tlfalcon@linux.ibm.com> <1a4e7b1ef1fb101cbb26fb9d5867ee46@linux.vnet.ibm.com> <83ca37f3-07be-4179-8414-88c8c83bfe56@linux.ibm.com> <7853649c6c1f2f4ce6d8bf9643cd1a43@linux.vnet.ibm.com> From: Thomas Falcon Message-ID: Date: Thu, 19 Nov 2020 14:58:46 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <7853649c6c1f2f4ce6d8bf9643cd1a43@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-19_10:2020-11-19, 2020-11-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=550 adultscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011190138 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cforno12@linux.ibm.com, netdev@vger.kernel.org, ricklind@linux.ibm.com, dnbanerg@us.ibm.com, Linuxppc-dev , drt@linux.vnet.ibm.com, brking@linux.vnet.ibm.com, kuba@kernel.org, sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 11/19/20 2:38 PM, ljp wrote: > On 2020-11-19 14:26, Thomas Falcon wrote: >> On 11/19/20 3:43 AM, ljp wrote: >> >>> On 2020-11-18 19:12, Thomas Falcon wrote: >>> >>>> From: "Dwip N. Banerjee" >>>> >>>> Reduce the amount of time spent replenishing RX buffers by >>>> only doing so once available buffers has fallen under a certain >>>> threshold, in this case half of the total number of buffers, or >>>> if the polling loop exits before the packets processed is less >>>> than its budget. >>>> >>>> Signed-off-by: Dwip N. Banerjee >>>> --- >>>> drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++- >>>> 1 file changed, 4 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c >>>> b/drivers/net/ethernet/ibm/ibmvnic.c >>>> index 96df6d8fa277..9fe43ab0496d 100644 >>>> --- a/drivers/net/ethernet/ibm/ibmvnic.c >>>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c >>>> @@ -2537,7 +2537,10 @@ static int ibmvnic_poll(struct napi_struct >>>> >>>> *napi, int budget) >>>> frames_processed++; >>>> } >>>> >>>> - if (adapter->state != VNIC_CLOSING) >>>> + if (adapter->state != VNIC_CLOSING && >>>> + ((atomic_read(&adapter->rx_pool[scrq_num].available) < >>>> + adapter->req_rx_add_entries_per_subcrq / 2) || >>>> + frames_processed < budget)) >>> >>> 1/2 seems a simple and good algorithm. >>> Explaining why "frames_process < budget" is necessary in the commit >>> message >>> or source code also helps. >> >> Hello, Lijun. The patch author, Dwip Banerjee, suggested the modified >> commit message below: >> >> Reduce the amount of time spent replenishing RX buffers by >>  only doing so once available buffers has fallen under a certain >>  threshold, in this case half of the total number of buffers, or >>  if the polling loop exits before the packets processed is less >>  than its budget. Non-exhaustion of NAPI budget implies lower >>  incoming packet pressure, allowing the leeway to refill the buffers >>  in preparation for any impending burst. > > It looks good to me. > >> >> Would such an update require a v3? > > I assume you ask Jakub, right? > > Yes. There was an issue with my mail client in my earlier response, so I am posting Dwip's modified commit message again below. Reduce the amount of time spent replenishing RX buffers by only doing so once available buffers has fallen under a certain threshold, in this case half of the total number of buffers, or if the polling loop exits before the packets processed is less than its budget. Non-exhaustion of NAPI budget implies lower incoming packet pressure, allowing the leeway to refill the buffers in preparation for any impending burst. >>>> replenish_rx_pool(adapter, &adapter->rx_pool[scrq_num]); >>>> if (frames_processed < budget) { >>>> if (napi_complete_done(napi, frames_processed)) {