From patchwork Fri Apr 9 22:38:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12195167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94AA1C433B4 for ; Fri, 9 Apr 2021 22:39:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32303611AE for ; Fri, 9 Apr 2021 22:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32303611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C6B2D6B0070; Fri, 9 Apr 2021 18:39:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C1A406B0078; Fri, 9 Apr 2021 18:39:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6D026B007B; Fri, 9 Apr 2021 18:39:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 84DDF6B0070 for ; Fri, 9 Apr 2021 18:39:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 46A86BA10 for ; Fri, 9 Apr 2021 22:39:18 +0000 (UTC) X-FDA: 78014295996.20.B88B806 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf14.hostedemail.com (Postfix) with ESMTP id 26905C0001EE for ; Fri, 9 Apr 2021 22:39:12 +0000 (UTC) Received: by mail-ed1-f45.google.com with SMTP id w18so8342997edc.0 for ; 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=o5smfWTBeSWz+1K9iKWeD4yaaW9jvNd0ya7vOOtleEq7dsa6W1uWQ9d2xekzU96UjG LsI5aoewbmudKIjK83XOmi5DmdjNJCSDcIO/RMZfB1WZpE30HMCcmxhYMGemor+ON5K2 nGvXlfz+fdMLl0SJQEgtXl5w85dA8v8Au8eL9t+yzSDjqfy2Dfs/Nha4d3PIz+C+vTjB gGURb5ilbjhlDv7d+GCkP7Ewi1ZNZTi9J28FCeMjpzlCFE95hqHodkgTbGQH974PDffk gYogc6QTMFDdXOxUY2NJC8rl9hY6PF+96INZt+f537eAGvIH2xPRkO9lZl6LRNX3EdJp ihWQ== X-Gm-Message-State: AOAM532VmaYRYGvhFZAUx6iQILHbmspkW3ECxCpjDS2l7sGkI6Fj97E5 Nv2/nbKXQ9+sD0MgdbNxRx0= X-Google-Smtp-Source: ABdhPJz5JORSKeWDpQgyWZS0/602VxwB/8eehkCneeNRCOvKRKPhoJLWpkp3+nG3FTnrzj9BVIHxxg== 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 26905C0001EE X-Stat-Signature: hbd57ya754bachni5fej8nja14pr9xtb Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=mail-ed1-f45.google.com; client-ip=209.85.208.45 X-HE-DKIM-Result: none/none X-HE-Tag: 1618007952-84622 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;