Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp12664pxf; Wed, 24 Mar 2021 19:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAiftmcKUPB32TjAuh0YfAZvztWcZ2tUcLLcuy9MBL/Zqjv+JdfygYVBiWlzZUKS88TrJZ X-Received: by 2002:aa7:cf14:: with SMTP id a20mr6538163edy.49.1616638558760; Wed, 24 Mar 2021 19:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616638558; cv=none; d=google.com; s=arc-20160816; b=eR3Q84i0cssJgM9zydAFR5+nb9SXN1Yie2NyGmN0pGu0tDcPYvtebNY7djIqvcas1c SZDFJOeZySNrVY4q85PmwX2L35Psnt72+pmGyn87F/8Lw1pNahYg0G6wtNRoZCP6h5eP CUeZHe2udtGLh/8RNYiQ9FlJriHGx91A8hXDpMX0Q/lJb5zRJO9hV1c1emlGtQEMmz0d Ynm+t8+y/atmGI2ERv1Ug4oWgu8ptZwLzEFTfl9q6cLejDaF4YQAQHA+Cq1ojC+oFLk/ pxiG4Z96pvZykcVCDB1x8Ubn/3sKScjWghq/rHsZheLErKSamhKP8jNmJ0kUKTtLY34x /iqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fIa5MTTbbF2h5i82NLwRCE2FeeKGdQ6mEyVMr3p46EA=; b=gaelVeEoeBhqk9JPWOiH4VfTn8USUQhnBLemgs2TkfcjoTHbWad3JnqmaxfEJBYJuh bo1GQAhBXdgMucaGRpD43m92M9FSJCh8yJO/Ol4YTZYd8UFml8uUS0FdJpB7lz4EExZg xzokWJMk7Y0xS7R3VpsPkMn/x87iliAEh0mu37eybWPH7vfIEpxL9Sb8wdc63INMUTCF kqWqX6rqikG6W48K2OMsE3wz20jbTg0zNK629bByUZ/lIlNartD5nnYD8BFSe3Pu5XQA Cq/aWDBIG5hSdPFIkUHkWMswpxGTyEoEKtrShOcSn9gVgGepl7QaAFOdIDy4koPoxYqf wSNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E3qsDSqa; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw22si2902206edb.429.2021.03.24.19.15.34; Wed, 24 Mar 2021 19:15:58 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E3qsDSqa; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234839AbhCXJ3M (ORCPT + 99 others); Wed, 24 Mar 2021 05:29:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22834 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbhCXJ2o (ORCPT ); Wed, 24 Mar 2021 05:28:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616578123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fIa5MTTbbF2h5i82NLwRCE2FeeKGdQ6mEyVMr3p46EA=; b=E3qsDSqadghYwVdxI2X57bKjwpat6JPxPbdldw6M0FETnwwTf26cThVwyQ6o6+LKYbZbIH Akrhe9mZJmvuJYDOUlve3lY/lSSlPmjta9vvxHsE76GuEU92o014ctK6lwNRkLHep93lLG g5Q6oySE7jIHC91LkGEMYbbmTO47yS0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-Gcx75zl2PwWiEtTkgVVUcg-1; Wed, 24 Mar 2021 05:28:40 -0400 X-MC-Unique: Gcx75zl2PwWiEtTkgVVUcg-1 Received: by mail-wr1-f71.google.com with SMTP id b6so794498wrq.22 for ; Wed, 24 Mar 2021 02:28:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fIa5MTTbbF2h5i82NLwRCE2FeeKGdQ6mEyVMr3p46EA=; b=uQRVzf1QMynzaAbtHBRT7O7HuJCOqWwICA96P0xNGuWqTViGswkdVFLdyCj3dH2lNm ztJuxL/Hv2TeALN6h4LOdJfZf3WEbEHcuh0UWrElOiEH6O8D50ONpclSRVV68OP/4BXP 2ZPNaDCwddTl00ZuwmcUmp/Q96fuwx7AiU0oaFyBdZRHxn+vKS1+ToXtufFvBzI9iq3W OtEzVwtpj2eFX7cSWTF0csBvTSmEOju+6h9iq4dZLs57+1la/WsmtCA6Q534AW/Dqt9e tmTKKPpsnEnuAi23ktDvmbffVTMZ+Hwz+ZwyxHJ0Y7D4HmIBbJ3GTOpwMVeuh357BL93 LsJg== X-Gm-Message-State: AOAM530DBUY566LPqDeE0QhnhY+brlQJi88iPyy0flNb1rnTckCZyS0a josO/oeqXYI/pZF32IawUrT9l/UbylrXLGMA4KNhwKi3Xo/8By5kp2GwhVzEhtdaFJTSahhtThg r7hCax26dp5NVWaUukpwexEUc X-Received: by 2002:a05:600c:2312:: with SMTP id 18mr1961712wmo.8.1616578119255; Wed, 24 Mar 2021 02:28:39 -0700 (PDT) X-Received: by 2002:a05:600c:2312:: with SMTP id 18mr1961690wmo.8.1616578119072; Wed, 24 Mar 2021 02:28:39 -0700 (PDT) Received: from localhost ([151.66.54.126]) by smtp.gmail.com with ESMTPSA id e17sm2493386wra.65.2021.03.24.02.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 02:28:38 -0700 (PDT) Date: Wed, 24 Mar 2021 10:28:35 +0100 From: Lorenzo Bianconi To: Jesper Dangaard Brouer Cc: Matteo Croce , netdev@vger.kernel.org, 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: Re: [PATCH net-next 6/6] mvneta: recycle buffers Message-ID: References: <20210322170301.26017-1-mcroce@linux.microsoft.com> <20210322170301.26017-7-mcroce@linux.microsoft.com> <20210323160611.28ddc712@carbon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="PFe7S71U15D4cqrp" Content-Disposition: inline In-Reply-To: <20210323160611.28ddc712@carbon> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --PFe7S71U15D4cqrp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [...] > > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethern= et/marvell/mvneta.c > > index a635cf84608a..8b3250394703 100644 > > --- a/drivers/net/ethernet/marvell/mvneta.c > > +++ b/drivers/net/ethernet/marvell/mvneta.c > > @@ -2332,7 +2332,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, str= uct mvneta_rx_queue *rxq, > > if (!skb) > > return ERR_PTR(-ENOMEM); > > =20 > > - 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); > > =20 > > skb_reserve(skb, xdp->data - xdp->data_hard_start); > > skb_put(skb, xdp->data_end - xdp->data); > > @@ -2344,7 +2344,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, str= uct 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)); > > + skb_mark_for_recycle(skb, skb_frag_page(frag), &xdp->rxq->mem); > > } > > =20 > > return skb; >=20 > This cause skb_mark_for_recycle() to set 'skb->pp_recycle=3D1' multiple > times, for the same SKB. (copy-pasted function below signature to help > reviewers). >=20 > This makes me question if we need an API for setting this per page > fragment? > Or if the API skb_mark_for_recycle() need to walk the page fragments in > the SKB and set the info stored in the page for each? Considering just performances, I guess it is better open-code here since the driver already performs a loop over fragments to build the skb, but I guess this approach is quite risky and I would prefer to have a single utility routine to take care of linear area + fragments. What do you think? Regards, Lorenzo >=20 >=20 > --=20 > Best regards, > Jesper Dangaard Brouer > MSc.CS, Principal Kernel Engineer at Red Hat > LinkedIn: http://www.linkedin.com/in/brouer >=20 --PFe7S71U15D4cqrp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCYFsGQAAKCRA6cBh0uS2t rFgiAP0c8Q5ppxzpPYMYk5waAY9QN9APUtx2G3i42vTAQpux1wEAsok6G5Kdb/ww bYEkrUU4/iizc56IifIQQ8iY05slpgk= =h2Ta -----END PGP SIGNATURE----- --PFe7S71U15D4cqrp--