From patchwork Fri Apr 2 18:17:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12181387 X-Patchwork-Delegate: kuba@kernel.org 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 C5088C43461 for ; Fri, 2 Apr 2021 18:20:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A527E61175 for ; Fri, 2 Apr 2021 18:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236339AbhDBSUy (ORCPT ); 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-Google-Smtp-Source: ABdhPJz4F+hOXmJCdVlQqFr60RgK//dTrF6RsVR8NEENtULfEy9P666rej4u+J51eUPB7k+8SIqYmg== 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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;