Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1709302pxf; Fri, 9 Apr 2021 15:41:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+YNu0nQ3wedVuvWgJlZuBmgAUzLf0KkSEwrLZOWK763deRfTXlfuB/9V5wjNeT8Z7L2ce X-Received: by 2002:a17:90a:c091:: with SMTP id o17mr5692697pjs.113.1618008090282; Fri, 09 Apr 2021 15:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618008090; cv=none; d=google.com; s=arc-20160816; b=dipYcA5DfXROtT71L/7WX6hk9fwcyjQtRnRRYPvtyxJo3vDzj8n87YeEhdGllBhSvV YW5rdGz0Ke/QIEn0AqiFIRE5oOxvu68mXcUPvFCAtFgIbpcyz2RpZnk/EKADsHFi7V4J wPGA8udCkzWvQ2FV9V0IFo48Zx8TBvyo0c1P/B56MxiSTiywCdEN0bLA9SD2pTho9ibJ oCYklpyq9aVacEsnBApig7eVYJ+khnBFPHKtCGePE2P5cMAYcHXOuyCKKsBK+ikXu1lF gLTpb9qvEkWQF8k0nzXcjk2yGPdK3pozLl1OnGnus8u/YxwfrVH4jvwa8mYu5b3X5Bnu AXGA== 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=ea9L0esZLw2eN1ApeVob8XRGXg7qFJ1cKUW8KNbsn624RRdttJaItb2QwVadYa2QTx jXvyKNRf6IIPvCRa4VQuv/LC9sEWSa58PJYHM0i0Crh903bdpJxlrSuRvPuU0F5HUNtp 9LMFiS5X7byeuvZWYu9uwg1CjfMpZjawvYz+gHAH3GUwl5rZRO4kWXQOKfXcCyRBax8c Y0v3IfEdIxuV2zPQ+PPOH+iRWqy02prE3r5oA22VmVu1g7HJNoLjam+2+prKRRuWLqNV dVVg8S+tq22RvjnQVuulmD4PjHMZdwscZ+tUgXPk58D6A7qaJXML86Pumcwk1+MBBYA7 ElhQ== 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 n128si4529722pgn.567.2021.04.09.15.41.18; Fri, 09 Apr 2021 15:41:30 -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 S235313AbhDIWjc (ORCPT + 99 others); Fri, 9 Apr 2021 18:39:32 -0400 Received: from mail-ed1-f47.google.com ([209.85.208.47]:46799 "EHLO mail-ed1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235120AbhDIWjb (ORCPT ); Fri, 9 Apr 2021 18:39:31 -0400 Received: by mail-ed1-f47.google.com with SMTP id h10so8244989edt.13; Fri, 09 Apr 2021 15:39:17 -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=U8bmuEQER8Mm1nx479pjhE3j02V0vqFZAE6NFIoBID/xb05O3ESl9NfYZIH9+Q4ire sG+76lM1fGvXRFhfbqEIwbn0t0gj9VGJIoGmXbn6SOXd806B2zkkbOOcGyhWC8VCuNTj MhSMPdjsQOQQDcpsbqUs9CiKJZnV8sBb38DK+BzaLKsNZX9d9hlmHymOmbvE9PO7gJqh ADu3HN+GPE80AzU4BrUIlEIq3PhTB0/AoeIxjIlDIn2HkqmE1X3N/OWNIwomxU1g2evO icAsMJiD5j6Vlz9qAXfpq838mqKby3CGHiP0dX9gWCXHz+0Hq3bmzaDgCw0QfUHGl1gE WgCA== X-Gm-Message-State: AOAM530i6NcMxGxDvWZ9tMw/Ns7PwzWVvN5GhQ2ss8TYqC5r6SqX7pHA F39D+TPFyaaEJ5taoKnNTCNhILHS05M6dw== X-Received: by 2002:a05:6402:3495:: with SMTP id v21mr19447203edc.117.1618007956846; Fri, 09 Apr 2021 15:39:16 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-93-66-21-119.cust.vodafonedsl.it. [93.66.21.119]) by smtp.gmail.com with ESMTPSA id s20sm2108726edu.93.2021.04.09.15.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 15:39:16 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Ilias Apalodimas , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Guoqing Jiang , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Aleksandr Nogikh , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, Matthew Wilcox , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Subject: [PATCH net-next v3 5/5] mvneta: recycle buffers Date: Sat, 10 Apr 2021 00:38:01 +0200 Message-Id: <20210409223801.104657-6-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210409223801.104657-1-mcroce@linux.microsoft.com> References: <20210409223801.104657-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