Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3040908pxb; Mon, 24 Jan 2022 00:43:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxX3/uuGozXxJS0ygHh0rwzcviTakDyJWfQgNOzSQ3IWqxocUC8D9Vx3S5CIf9dmMygUjpI X-Received: by 2002:a17:90a:14f:: with SMTP id z15mr874756pje.162.1643013804070; Mon, 24 Jan 2022 00:43:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643013804; cv=none; d=google.com; s=arc-20160816; b=IhiCWUAqffYvLWIr1uq7sHAHA7hm/1bgCfSAkM3H39n5BrIIMKhXMFnCXYAbpQZQwm fx9TI02n1rA4UhkgeLrdby0+FU66JV+XP/YNaPYvanh9Pw0gQanzFNcrWmBmHF6M2s4D p0P3KuxN36U/xI4I9gT6jVZ5Z3JefRAT926ipvRTYoHRZBkP1LAa0PYCuxu7kFloCZ6L lfTx+gKzm9xzOuPYKCSGNyNVl+PbQ85fS/F6c9M6E4xAyO+FSSjaQDfMNHYtWTmZltW7 au4wt/gRw4JDlpNhNNOFS+AdXbYMid+7hRcxGXTnBkUKz6Kb/W59UZcpavEhOk/JPXIv 0rhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=c57q6A0FIP4IDjy6YM47YIIs0GLG8LtYvDjNRte3Llw=; b=IoR6hlgURTghGPXUaaoWdIFTa00uwlyIyfwoD+/mIfdKTrtDMZx+g0v/IgbqdsKhZ4 0d805MCPVScCuYBz11X3bFAQqT+nzYkw48fDLDWFyztecDVSmszpFap4eyRYRW5XmUf3 YUKPmOd+iO27o2IFY5qn8mu4jBh0lCknljqT4yYd8PyaX5klOhfWqJeMlUX0v3eUe/Vh ch1G8DBlnP8yzFYW1k+wdRu65F9lYJ+5GLdYOylCzRvIDQIj7uQHoSiFs1U1rDFC98OL A05qS9yqpmPmcTMwjtH+8Sf5T4Fpi1MgUPDgqxo5O/X6YGb4HVVjiveDWTmxWdKXrBp4 Hr7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fFlj0Lcb; 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 p38si15373475pfh.29.2022.01.24.00.43.10; Mon, 24 Jan 2022 00:43:24 -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=fFlj0Lcb; 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 S236276AbiAWL4e (ORCPT + 99 others); Sun, 23 Jan 2022 06:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233015AbiAWL4e (ORCPT ); Sun, 23 Jan 2022 06:56:34 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D450CC06173B; Sun, 23 Jan 2022 03:56:33 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id s61-20020a17090a69c300b001b4d0427ea2so17647818pjj.4; Sun, 23 Jan 2022 03:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c57q6A0FIP4IDjy6YM47YIIs0GLG8LtYvDjNRte3Llw=; b=fFlj0LcbPkFliHP92jkU+DlBHAdQPePh1gwbYro3KuoMi48AENtp9PIF6dR0sGMDVf tzE7tHzb9+Ht+F1FkT1ZldGmbu2P5A8DADT8MFSqZT/xRWKmVds/t+dfgQxLzf4knBbj APfEJHiJCXtY21FSLRb/wxssAX+qgYDB093MSEEvQKuOq39zOiPiSsUTGcU2WyVJwWt3 jUIH0zx+Sg0/2YAWL4BZkUGn5I9phHZGbHuFf7bmW3F8o8lCj3xbxOZjBlBUB8djxSs/ RY3vtG7STVbsVKz16PuxfAf+o3yG0dX1JTaPt4falnehIquCq3WOaidMTC5pUuu9crQV Up7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c57q6A0FIP4IDjy6YM47YIIs0GLG8LtYvDjNRte3Llw=; b=CJNI6qwXXSW+rvrU9dRorwKVPW/8sqj1NSsvNDhWnmFN64XNG7em48g71zvp99+aeG uMX4alXnubVLzqoYhFUKFwXJ1/ba9kmI0zTS5KGvnB1nAcOQtaFDVsvMCmsRSbUmdTd4 sTmip1vQbJWjS8O6Ggw3JXDofeH/P5K0KQr6BCca9XAGcE2uClyeH916VRLaX4EcirKC /CRxGN1ONMBNgNm7IugU/Nyna+5jUUiJDCAy1i6BPbyIFNpgQCvEzCBtBhpg2csVv9uR tAXSwLVv3ttpJOydzmIlVxyKMCMxU2Pu8H5igh8SpzSv0mt3i/x+OU2Zy+QUocRio+Hw DBXQ== X-Gm-Message-State: AOAM533zDuG5CPZ8FcrCfx1sjGVZeHUj7Jc+8MsXW6V+JxI6eaUugrol P9ZD550B8y202naCrnjdgfM65aZhT1S+8Q== X-Received: by 2002:a17:903:1107:b0:149:98f7:9629 with SMTP id n7-20020a170903110700b0014998f79629mr10705685plh.160.1642938992789; Sun, 23 Jan 2022 03:56:32 -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 d1sm12808152pfj.179.2022.01.23.03.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 03:56:32 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: 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, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH] net: ena: Do not waste napi skb cache Date: Sun, 23 Jan 2022 11:56:23 +0000 Message-Id: <20220123115623.94843-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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() 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); 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