Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3504981pxb; Mon, 24 Jan 2022 10:58:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2vAI3+N2PaWvVrtDtCuec/z15FLZvkB//+keUSTcHHx9zqqX479zXovY7Ma1yJX+3uoBp X-Received: by 2002:a63:8c4c:: with SMTP id q12mr12652631pgn.149.1643050700250; Mon, 24 Jan 2022 10:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050700; cv=none; d=google.com; s=arc-20160816; b=pIcNldaSWhSIIv9VsvwQmzkge880SR3sXuz5KYHVuyuscITYtR7uyxbBrWbJkCSATS 3ycae7xBrqAcHqj0AhOfRejZAs8XikrhtzIQwBhxVgnLs37seF/WMm+LCULzhUPe/j6I H66lNsAFZF678qUfGExO6iJQ4fp9MCw+tsPga7XlMyGymrRZ3HGnBdiNY7vGNp9TCeLP Ha4Id3mqIMlrp6ZV1VuxOn7np6+nJvk6LoosZzyiZwWBszLAIHGtmp073xRh01zHuuzg 6/+YsTDMGXkwtoOPkU3C4lqYHlnwJIZ+89AuLbW/TjGlSqKdIDvQaWUSydKlCasPvaer MDJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=BylAZRLZiOyBqUYQ0byZHJ8IV+2vCMweAI+8MNCkOSw=; b=sPP7hm7OiNFGpURMdZJ9FfH8CDYSA78kaBNXh7/lAHmYl9P9P32m2m8RF9/PriX4SP YDk8pXSQK1Rxtj5ILxrsLHq1E4PXN54y6+cdUWjCHflnRnBdigYmElKsvLU6ynI1F1kf YpGZx2DeEMuOgyuAnZMa4++IndCrZKebQ5yfEU9YciDZNOIH13wRbeGUmDYm6GYNMdOa OO5EPC40BZkHXsLz3sbP8FKX9luK8KAWxjn8dIy86S5Jb3s1SPW/JEE3RNxwjiiDJNH4 uYmckjaFHIt2/GQ4WQl6yZBSCycXFG+DG1OIiggu0HU03sXWtkilj2YDkrZMD1JYak8a gJag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=evmatsRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si18007151pgw.509.2022.01.24.10.58.07; Mon, 24 Jan 2022 10:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=evmatsRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbiAXJaD (ORCPT + 99 others); Mon, 24 Jan 2022 04:30:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233779AbiAXJ35 (ORCPT ); Mon, 24 Jan 2022 04:29:57 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9D56C061744; Mon, 24 Jan 2022 01:29:56 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id q22so2963199ljh.7; Mon, 24 Jan 2022 01:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=BylAZRLZiOyBqUYQ0byZHJ8IV+2vCMweAI+8MNCkOSw=; b=evmatsRBhp0/WOQ6RRsVjbljlAIKAaQd4tBlKQcs7K8Kxke9edWg/RHg5ok34FlOco rEwrqfvBKTIHQV/D2zKHNrBy0wLop6PlPos3DQxzpXzx6wt151QCpfusd71QDtCYNJ/V y0Ur9Yv9FImNk1dfkSsX0q/4ciNt6UDF/7QNzJQRGojSwrYZMcCgPCLG8LQ4r7HwU+U3 C5OhqCavFsBgSBebt/ehSxlIVon8diqlRI4LnOouqKPJHrzAIOO1930dG8D/qmSZo/w2 CttQ9KVuKr4+dssJ9Dcf1AtD1V1ja0CFuYQN0FPpKfoCjUihkczOumNbA9o6+TYH2LIm 6kmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=BylAZRLZiOyBqUYQ0byZHJ8IV+2vCMweAI+8MNCkOSw=; b=XhYb5meEM7Ra4CpJN8r7M9K9D3mfM2xahmLZzu07h0ciuUwVSKMEnTd1P6Ae8dI19O SU1iO6nSHPM5BF0CaC8vH8WqUkLETt44ZgGVBtZk1p5YYW272BsLz3y9H8KbX2OdVgUk 6KiZJjFu/pK342h4xkwBBYq5B978k6RNVgSFR4OF3eRYoeVqbiHABFM6FjG0IQ+mlVWW 1VHf3IefDygQqme3a24GaUVYqmfKxFyntadgmBzlh7NAbXSRMOgaqJkdl7JNOUdmyCQV hMvRoscf3MGkROIaM8zIScTn9trkr/TUurC3QufR9ZSUMt0yCb+fkofayC90nmcFo/F5 hpRQ== X-Gm-Message-State: AOAM531ufAtx8ia5B5vg8YZHTIUoS4q/i5Em/MQdivKLOMPJq7SADZTS o1cBOs5f7matOMJY++kYZck= X-Received: by 2002:a05:651c:1198:: with SMTP id w24mr5392186ljo.42.1643016595297; Mon, 24 Jan 2022 01:29:55 -0800 (PST) Received: from [192.168.8.103] (m91-129-103-86.cust.tele2.ee. [91.129.103.86]) by smtp.gmail.com with ESMTPSA id n15sm454493lfi.101.2022.01.24.01.29.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jan 2022 01:29:54 -0800 (PST) Message-ID: <5cca8bdd-bed0-f26a-6c96-d18947d3a50b@gmail.com> Date: Mon, 24 Jan 2022 11:29:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] net: ena: Do not waste napi skb cache Content-Language: en-US From: Julian Wiedmann To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, netdev@vger.kernel.org Cc: Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , "David S . Miller" , Jakub Kicinski , Daniel Borkmann , Sameeh Jubran , Wei Yongjun , Lorenzo Bianconi , linux-kernel@vger.kernel.org References: <20220123115623.94843-1-42.hyeyoo@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.01.22 10:57, Julian Wiedmann wrote: > On 23.01.22 13:56, Hyeonggon Yoo wrote: >> By profiling, discovered that ena device driver allocates skb by >> build_skb() and frees by napi_skb_cache_put(). Because the driver >> does not use napi skb cache in allocation path, napi skb cache is >> periodically filled and flushed. This is waste of napi skb cache. >> >> As ena_alloc_skb() is called only in napi, Use napi_build_skb() >> instead of build_skb() to when allocating skb. >> >> This patch was tested on aws a1.metal instance. >> >> Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> >> --- >> drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c >> index c72f0c7ff4aa..2c67fb1703c5 100644 >> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c >> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c >> @@ -1407,7 +1407,7 @@ static struct sk_buff *ena_alloc_skb(struct ena_ring *rx_ring, void *first_frag) >> skb = netdev_alloc_skb_ip_align(rx_ring->netdev, >> rx_ring->rx_copybreak); > > To keep things consistent, this should then also be napi_alloc_skb(). > And on closer look, this copybreak path also looks buggy. If rx_copybreak gets reduced _while_ receiving a frame, the allocated skb can end up too small to take all the data. @ ena maintainers: can you please fix this? >> else >> - skb = build_skb(first_frag, ENA_PAGE_SIZE); >> + skb = napi_build_skb(first_frag, ENA_PAGE_SIZE); >> >> if (unlikely(!skb)) { >> ena_increase_stat(&rx_ring->rx_stats.skb_alloc_fail, 1, >