Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503166pxb; Mon, 24 Jan 2022 10:55:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0PGdePr1zhlV1gpW2wvOHxwJvtpZ4haKo5Yx/UgkRaOwZ79YgH7dRY0QYifLaSYQwgFCH X-Received: by 2002:a63:7549:: with SMTP id f9mr12527656pgn.259.1643050534211; Mon, 24 Jan 2022 10:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050534; cv=none; d=google.com; s=arc-20160816; b=K6pgxuGvuR76eS8o/Qwz3akJz85NTmwYzM4sbItoN2tj6MifgqRtaHutQ1WPw287uM liV9fGBf4ORLNTDCFNiOSe25vHcGOP4agKqyO8d/KM0YsuU6U7+C90uuW8lIdtQRrEKI ijBluoh8R6si6SgA+G983sQYGLKiflPtIKNoUQCLrX8wdORW1do5jCTKDlvA2Sy7AFzM ntgitdtZP2AlUrxpKEukb/15e66MYXVH2noGvH2E20cCGMSNnl0ogf5RceQs3jFp3anj M3ppIbbnZUJmGflKvsSeRz5Ivu7hnLo91sb+xWYq6IvkAtTrLAtNKsGkEedLjT+Uqgl9 kqdw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=mSKXyc98nYLlNnODsXW67iNaHjhwuGUH6qhzM605fN4=; b=WQPrrWdjV8IdOW75j/b6G+9qz14hZxmrJYvuiLMlOojdq8Y131qosXw0BlI2EbB3e1 iTtg52e6lkiSawz5lK5YiXZPxYEUfBWGx+93yULDbe3c2qfL6yfRh46L/ZDStnY83rzV 1aMcexjZD/GxX1U1z1pcfTU6wRlzmLJNP5Y0WOJx0FL6lsrLU8bJUHsUKDYNl8M2WVDk eHeDTAlXCqQyemVMho3ofHtt60iNgkyn0gk+aCOZlizUlXIQNEfTrzqMSqZJav3YCviG NIjrt8i9s5xx7BjWfpnBX0WE5ZBVTb7UN1akz52C8kole9VYreGGpICIiI19tENcUclQ EqrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PCd9xx8G; 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 e14si13848548pfi.151.2022.01.24.10.55.22; Mon, 24 Jan 2022 10:55:34 -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=PCd9xx8G; 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 S242541AbiAXI55 (ORCPT + 99 others); Mon, 24 Jan 2022 03:57:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232822AbiAXI5z (ORCPT ); Mon, 24 Jan 2022 03:57:55 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81018C06173B; Mon, 24 Jan 2022 00:57:55 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id b14so4806402ljb.0; Mon, 24 Jan 2022 00:57:55 -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:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=mSKXyc98nYLlNnODsXW67iNaHjhwuGUH6qhzM605fN4=; b=PCd9xx8GHchBs73B7IKdooCUpV1yfFBvt+aZThklWhAIVftOL2III86q03e40OYuR4 l/1BiZwj2tGJ46+91Wf8dAkOv1gZOux+Jr94pbuSHub4WIuYBAnm29P3jlHIc+kStokl HBy9Wa+qpalOgEhVAf60Pl9TSbuv6gd6pw7mowPWpGB7v4fymAxfZP1moUl3+f3CkUhi MsLxh5y05K02NgoTkVSSAdGyfFZ4RBQNkgpF1aJuZg+XHp429epfMwBB7+//MgOFsNl2 qbbkJwHepfe8+zoGa3t+M/M5gqIKVQjTpqe9RAKwqwinEOhS7FRiSQxzwXlvtoUBK6oi 1mcg== 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:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=mSKXyc98nYLlNnODsXW67iNaHjhwuGUH6qhzM605fN4=; b=wV1gGYFfxWqjCp8xilZicOoTDhiO1zQ1W0vIlFGKa0NLuAk6Zro8Z0p1wz6oqBdhsY 99sqMfdMjh/D+kagL58oGzvXZP0uYYf7IAlA7qWnmHmXsR3yV/Nnp26G64DAgdr62uly yvUZgBuiV21fWZ/p7pLjfw4Bv99qIfqZ/B0dFjj3SI3PrRT78ISQhkUSxDuX276ujE6w 9NTTlt68fry5Nf/gfPkG9XKgqrkd5C2/nZufcAr2pDwFL9+CgMnsWzFLtIJ6Dp3QWiCj /8CGq7oxrza9BgnGFEpjVyo0crKQjhjQ1LS2k401IzFKRQYOIM0VymVPf/JS6kReqms3 S8Bw== X-Gm-Message-State: AOAM531sUT+oiUj5sicKUgum44ISaVWJXRGveR0Z32KRf8+7tmUl2DJP e0fOSPY/VVEixJCjJWEGxn8= X-Received: by 2002:a05:651c:10d2:: with SMTP id l18mr4866693ljn.39.1643014673828; Mon, 24 Jan 2022 00:57:53 -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 w21sm1099073lfu.249.2022.01.24.00.57.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jan 2022 00:57:53 -0800 (PST) Message-ID: Date: Mon, 24 Jan 2022 10:57:50 +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 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> From: Julian Wiedmann In-Reply-To: <20220123115623.94843-1-42.hyeyoo@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). > 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,