Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp132025pxb; Mon, 31 Jan 2022 17:19:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTwRaiwLYUrXt/uirQnWWtGKlzsEjmY35+9CWwLrgV6/1yf7W9yb+cxF3kDm4LOFGGYsoJ X-Received: by 2002:aa7:c0ca:: with SMTP id j10mr23304976edp.181.1643678340344; Mon, 31 Jan 2022 17:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643678340; cv=none; d=google.com; s=arc-20160816; b=Od4fTppPBlBxTvQH6N4l+4xAThWtKQilREmevyzQG+yjzO9dqx/3PMJBeKbkba7vyL sj+03+AHV6Qbi05OXLTXxHHxb8CAorcibubUyBCzZ4je6GOx/sibyPXLKBS3PLoEN/uR nK62R9/AwpK7LteFQi0bNlxH/ScJgbihgFgJrQ+A6eTaMyBcigfaRfY4ohFaLiGEwvzC qi3kqQXHOAlh4NUWwEjbdwc4eZlSlXvYkZefPAcOTcz9uYpIY9QE/re0CY9U/fkFw+bT dCHR0AQECHMzulUouHxvURueehAz3grndtEsSgBgecoFFeUBsVJSJa/gYbPvu0DdGfao 9niw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=a05V4ozyXx2YyDX8DIWgRjjIxEZoALk0gSpI8hkYt60=; b=TAoE8hCxoxJP2qgCJu+4jt6QAaE+wqjsUcS/OoF5zl9pWnkA4XD5h9ROKxISsIpEpX JeedGKlqgiir/EYaW/W6/7cO71lcTRMYjnBqql6nszSZLdmWHy9FrF8w9N3cdq1G1B/r gTcI3pb9vKSJ1pZI+sZ4IJm/Bs77P87sPUZWtb6aMmeUpIUUzTb6mAndna9PsnekNqoy L7qL6EY1ZT7YPalhhLlpqDq2gI7IFkp+SK0yVo3hHgddCD3tFGHV2zgLxnVyY7Qvmhv7 85dSyZrzdmMyL1rLuQxgjj2Qi591iN1VkX5YOitOJ60Iu/YUe2Itfj0k03THZgWgWR5+ /wig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Kj0r4g1Z; 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 a20si8850095edb.81.2022.01.31.17.18.36; Mon, 31 Jan 2022 17:19:00 -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=Kj0r4g1Z; 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 S243773AbiA2Ixn (ORCPT + 99 others); Sat, 29 Jan 2022 03:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbiA2Ixm (ORCPT ); Sat, 29 Jan 2022 03:53:42 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD20C061714; Sat, 29 Jan 2022 00:53:41 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id v3so7409265pgc.1; Sat, 29 Jan 2022 00:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=a05V4ozyXx2YyDX8DIWgRjjIxEZoALk0gSpI8hkYt60=; b=Kj0r4g1ZMDIk4p86Ak/uNjXu8XRB31hUfA5AIWSl/JY2D/YIW73E0ABXKWNkakq06K bD3HxcnN5YBgQ8kpKoF4nG4uY3FmlVySxYiR/3alBcF5zTWkcqC3YMXSq6ZLRZNVs5cN I7kdhupFLui17WWvAilOLJyQkiBboFQncqKR9aKui8lEQdoDevPRHz+gynR23eu/mVty VkKFF0ky7YeUwpApt94TvCUa+Y7EvPIN2NnJ20N/ecaeWRJ4B5Vk4w5nK5uoegYs1gAO rafAteQmE8PD4W4Bkt5di+eQDMTm4S8m9r/AUvapAnB1/BBe6VBfLe42WzV05U4oTnZ+ su1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=a05V4ozyXx2YyDX8DIWgRjjIxEZoALk0gSpI8hkYt60=; b=qlMno8WhmxFSCYcXptgkuqafcl6dYezQ3nVVA733A7g01dJGU+AjHqfPhuRchoBg4b vjh/O8qVgj6Tlrb9V3WDvoy0sxZXO2wIeXTdO5gHO0wsy3cMgt3mTJq7mXrgZ2cLin18 igQquvl2cm9HCX7vTLmidL1Cilxs8EVxHSkza20kFqxvQ25CUskHpcQ0McpW7zLKtW6b ncWZZwk1SB7z5FExyvYWctV6DCAeXsjAUM+TIJwtef60no/vZ4krNOxE4EDUp6IxtZXV XdNa7SMvcv80k8o+PqnepddQF7jkD/V22ORhNSDjc5sAqrqhIv5InXSH4ys0O2Mf+w+O SX3w== X-Gm-Message-State: AOAM532sA6PBkN919lvxfkisRDhfgcQcf1UaxAa40Cqv0jg//M/sN8QA 3Wlz9YVZKvMn1XnTMCvKYRihjacqVQvjuw== X-Received: by 2002:a05:6a00:884:: with SMTP id q4mr11570615pfj.81.1643446421000; Sat, 29 Jan 2022 00:53:41 -0800 (PST) Received: from ip-172-31-19-208.ap-northeast-1.compute.internal (ec2-18-181-137-102.ap-northeast-1.compute.amazonaws.com. [18.181.137.102]) by smtp.gmail.com with ESMTPSA id k21sm11932108pff.33.2022.01.29.00.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 00:53:40 -0800 (PST) Date: Sat, 29 Jan 2022 08:53:36 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: netdev@vger.kernel.org Cc: jwiedmann.dev@gmail.com, Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , "David S . Miller" , Daniel Borkmann , Sameeh Jubran , Wei Yongjun , Lorenzo Bianconi , linux-kernel@vger.kernel.org, Jakub Kicinski , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH v2] net: ena: Do not waste napi skb cache Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() and napi_alloc_skb() when allocating skb. This patch was tested on aws a1.metal instance. [ jwiedmann.dev@gmail.com: Use napi_alloc_skb() instead of netdev_alloc_skb_ip_align() to keep things consistent. ] Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Acked-by: Shay Agroskin --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 53080fd143dc..07444aead3fd 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1400,10 +1400,9 @@ static struct sk_buff *ena_alloc_skb(struct ena_ring *rx_ring, void *first_frag) struct sk_buff *skb; if (!first_frag) - skb = netdev_alloc_skb_ip_align(rx_ring->netdev, - rx_ring->rx_copybreak); + skb = napi_alloc_skb(rx_ring->napi, rx_ring->rx_copybreak); 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, -- 2.33.1