Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1472690pxf; Fri, 2 Apr 2021 11:23:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdsrLwKtIX0vrByEk5kQdOV/H4lzio+733Zbr2Y/aj+A0kZmCHfHlr2fZLUOo+Mrf7TTFI X-Received: by 2002:a17:907:720a:: with SMTP id dr10mr15078630ejc.375.1617387830799; Fri, 02 Apr 2021 11:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617387830; cv=none; d=google.com; s=arc-20160816; b=CnRb0vXWeLyQF4E4/vjCe5eoiYPKO+YHW/JL/ADgF9qmHPX6h2YZirs33TttcSsgrb 2xgC452OQPaxoEzKbzHr03Zsc8iUbQmjrjzZ+9NvNt6DmyQDLrp7ckpiuU5t/EldVb4m ts93i1mrg8koseiCNmIWaPscVhhqaDACafX5QIk2mUywDkEpYYm+ptDndp9fTheJJeP5 vYz/0acwBKKwcnz+AzqoQsCjRUYgVD+OU08M4EnhdGVZlD5wtofrET+hky3jyacxGGWm R083agsZqljOokfGuHrTiGL/HGUc59yD8i2FATheTNCQZSjesjQD5klOtT6DSzklqFi0 Gnow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Hfpx7yH1JMhtuw/p34rqv49BJ0OaG3mtjrffrkk1xkI=; b=hK/3FVq9l+bBjRFY07qmJhBaeF/b8dGQg6W3Bk0M2e0irJN2D2xGdY/4A+bg7XeAEv 6Un+bGYdKp12v67YjP/aPy2ZaWA20dPXMmuk2Wvo8EbTgQ5IL3/xJP/OTWFXSGF+EMfI U+U8s8YsqPnuJQxdZffAS5J17CdRIErY3PGQ9GMXkCQ/D8OisFqGcYGTXC8LOpahxkwa he8ePPJMSQwOr9R0F5DEgstqaS89fqL77+khe9Cme2FRyN//0ZjILF8HBevY5zdFL7Ws m7GNKevzoxaI/qMQffYL5n9OYw9EWq8491e0xtmDqPUnFlJ0xhy6fSgakNrCh+Qz6tGz XyXQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si8165324edi.504.2021.04.02.11.23.28; Fri, 02 Apr 2021 11:23:50 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236092AbhDBSUy (ORCPT + 99 others); Fri, 2 Apr 2021 14:20:54 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:39564 "EHLO mail-wr1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235247AbhDBSUx (ORCPT ); Fri, 2 Apr 2021 14:20:53 -0400 Received: by mail-wr1-f47.google.com with SMTP id e18so5388644wrt.6; Fri, 02 Apr 2021 11:20:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hfpx7yH1JMhtuw/p34rqv49BJ0OaG3mtjrffrkk1xkI=; b=Tj9XhcQL7k3M9glHfKJa1ov3CkKFHXHVkE0AzAirwiAYMcJ/Q4gdujj3TMc36RiZOY 8HOjErS7vMCR5KJ9049JucUE6HHdJGPLR9kJLYaF8AwLNLJcAYeDx3kjg2R/r+YAuEFZ fgPgR0BDUnRKZvlBBuhlxmG9MM+NBqG7RiuLHBypHy+UQmtQngvvrbMt73YtBTyjJI0B TpWoCnWfqtU1RKxj8Q+AWf1CUgwPMlSTxtznAmJvSlC9FW+4yXGXyNyayRCxu8+mHqbS M8VGrbVBkVDWDietdwpzL0UEsZo9AJPCLALlY0ah/xYZtlVZbH0LgEBPlV9+rvUMDQk+ 88rQ== X-Gm-Message-State: AOAM532BaTAPbgTPC6AiYCpyApl5SLiFUsmca99FRAZaJt6ILWP8b1+o Q3RwhYUq8g01lIkP2jjA2HyoWcoAmtU= X-Received: by 2002:adf:fb0b:: with SMTP id c11mr16645225wrr.425.1617387651263; Fri, 02 Apr 2021 11:20:51 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-2-34-63-208.cust.vodafonedsl.it. [2.34.63.208]) by smtp.gmail.com with ESMTPSA id l9sm11472831wmq.2.2021.04.02.11.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 11:20:50 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jonathan Lemon , "David S. Miller" , Ilias Apalodimas , Jesper Dangaard Brouer , Lorenzo Bianconi , Saeed Mahameed , David Ahern , Saeed Mahameed , Andrew Lunn Subject: [PATCH net-next v2 5/5] mvneta: recycle buffers Date: Fri, 2 Apr 2021 20:17:33 +0200 Message-Id: <20210402181733.32250-6-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210402181733.32250-1-mcroce@linux.microsoft.com> References: <20210402181733.32250-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matteo Croce Use the new recycling API for page_pool. In a drop rate test, the packet rate increased di 10%, from 269 Kpps to 296 Kpps. perf top on a stock system shows: Overhead Shared Object Symbol 21.78% [kernel] [k] __pi___inval_dcache_area 21.66% [mvneta] [k] mvneta_rx_swbm 7.00% [kernel] [k] kmem_cache_alloc 6.05% [kernel] [k] eth_type_trans 4.44% [kernel] [k] kmem_cache_free.part.0 3.80% [kernel] [k] __netif_receive_skb_core 3.68% [kernel] [k] dev_gro_receive 3.65% [kernel] [k] get_page_from_freelist 3.43% [kernel] [k] page_pool_release_page 3.35% [kernel] [k] free_unref_page And this is the same output with recycling enabled: Overhead Shared Object Symbol 24.10% [kernel] [k] __pi___inval_dcache_area 23.02% [mvneta] [k] mvneta_rx_swbm 7.19% [kernel] [k] kmem_cache_alloc 6.50% [kernel] [k] eth_type_trans 4.93% [kernel] [k] __netif_receive_skb_core 4.77% [kernel] [k] kmem_cache_free.part.0 3.93% [kernel] [k] dev_gro_receive 3.03% [kernel] [k] build_skb 2.91% [kernel] [k] page_pool_put_page 2.85% [kernel] [k] __xdp_return The test was done with mausezahn on the TX side with 64 byte raw ethernet frames. Signed-off-by: Matteo Croce --- drivers/net/ethernet/marvell/mvneta.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index f20dfd1d7a6b..f88c189b60a4 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -2331,7 +2331,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct mvneta_rx_queue *rxq, if (!skb) return ERR_PTR(-ENOMEM); - page_pool_release_page(rxq->page_pool, virt_to_page(xdp->data)); + skb_mark_for_recycle(skb, virt_to_page(xdp->data), &xdp->rxq->mem); skb_reserve(skb, xdp->data - xdp->data_hard_start); skb_put(skb, xdp->data_end - xdp->data); @@ -2343,7 +2343,10 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct mvneta_rx_queue *rxq, skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, skb_frag_page(frag), skb_frag_off(frag), skb_frag_size(frag), PAGE_SIZE); - page_pool_release_page(rxq->page_pool, skb_frag_page(frag)); + /* We don't need to reset pp_recycle here. It's already set, so + * just mark fragments for recycling. + */ + page_pool_store_mem_info(skb_frag_page(frag), &xdp->rxq->mem); } return skb; -- 2.30.2