Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp346484lqj; Wed, 10 Apr 2024 12:09:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIQYEm8poQ9uvmpf9QIJoqGhjP8AnAoZo+GxorSHlkNfIzzonZgWJrJygCexCA1oIHt6JJwB9XIVdcc95KIcR1uPg09N1NYfnGKaezZg== X-Google-Smtp-Source: AGHT+IFD1S+e8iMz7ACh9JPM93QoNGRmWsdTpyif/LmS+04AvbvlAwD4PFqVJa94X05EVmnKeBvQ X-Received: by 2002:a17:907:7ba2:b0:a52:10c4:edf4 with SMTP id ne34-20020a1709077ba200b00a5210c4edf4mr2094803ejc.4.1712776191583; Wed, 10 Apr 2024 12:09:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712776191; cv=pass; d=google.com; s=arc-20160816; b=DmIunDfd+j12r6wdvCRl4A7Jl8+r5uKeLfBIhZG85sTDmmENDH2nnrBNekpjXlOB9n uuqscaQuD8IVxMDddWC3EhBES0iV2ahj72NkYtJOQ49hmEdMVG5Oh9Rv1v6ODJqtCX0x OwjzEFR7ematnnqYWu+t0K2YmyoYFhSHnqffCEYFUn0hCg1cZMEvosArUexV4LMifqXY o8CeWVIw6UMiLO+H8D0Uf49l1XNgk7hT11KNARX+Sc/oIxfjM6Nx7bQi9PGj02J8L/Xq 7KZJEAy07p9GhamfGKhuthMOpD+zPoZj/AA1PNbD2jOYIsR+eWza3DW3yJEmJvQzrhvX w4ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=bIo2EVourWrLaohp5j6QNkkQsISAFdO4wMswAJKmsJ4=; fh=lAa+XlTdLS9xLviyR3KA7tgvlvX3WSgq7QlgprIyY7I=; b=OrMeJyv3DDFGnqG9MEHVVK3vuAgz4M8/ByqYfrrDVMzCmc5DzJIlpzhUjNZ2DivOP4 jvdecacesERC0zg7yOXnmx4692sz3/tmw0X3LZp65r26A7ZMXIqoEYlGmWLHEsFFib+m ZlNqJ/J5mJ/MPbBZcTTmhwIp04I7rn5RjBMnuoNbHQ1aVN40DWQIPRPs9G4CrEJZXWeL 6CeXPBC8hthmU1pR4GsNQiJjcbp78pE6euS/OwT0OaM13q35Q626qtSPFDp8mjZ10chi Xfbf3l3895PB2y0A6VjjSHeE/u1GESugOXmoyZppZgGtucmMa6C4VowuApOCtI4/RVcH CyLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2+gvAbxm; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-139246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i21-20020a170906115500b00a5210cb058bsi783609eja.131.2024.04.10.12.09.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 12:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2+gvAbxm; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-139246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 490811F21A82 for ; Wed, 10 Apr 2024 19:09:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F4E6180A9E; Wed, 10 Apr 2024 19:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2+gvAbxm" Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A599453372 for ; Wed, 10 Apr 2024 19:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712776182; cv=none; b=bykNIAIB4NmlAaEpkWNzP6PNjuFJTZITw1OAr7RwDql52aCYjuXZ9lc+qJSls9nAe5MglrLanQVfvdPbCkjuXYXPer5M7+lNsZdtghUHD9DSJBrwkU4PuFx9fT8kmpYClY6BLb1S5VZP2+zQBQ+w0WhhQlTAFBW37poU1ewYoT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712776182; c=relaxed/simple; bh=3vpVF4t7apopDMRyVXzObK4S1vRFFr2BvTpMBTZ17jw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=meU2Gvv2LbXVBfokjhRDgrD2Ah+brCi2zdUP4gtPl81TWYgop/CuRRcpBNzbGpK0LVcAdrVQyNOns2zyGwZ5f1QBMqSxWK7/4/qBivkS4sfGGy6uYQdEwKvlawYuxLb0MnpE1ZN04wb9yWuzhRkLWaIr4R9aacJ0T2933bM9p00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2+gvAbxm; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-516cbf3fd3dso8215543e87.2 for ; Wed, 10 Apr 2024 12:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712776179; x=1713380979; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bIo2EVourWrLaohp5j6QNkkQsISAFdO4wMswAJKmsJ4=; b=2+gvAbxmmzzAKUt5ZFXEgjLwBBIoYd/znXmBjZyRqa6rG60mYcFviZ5Tqm3sU8QCAq s8KIOnyM6wewe++PgEuS2J0X1Df8ZrFzX7VOmtUSp5dBjBkrIm533TaoVrFh1ISIWlSe sKd/B0npqipRnNgpjLz3JiTogQqXippRTpOVO6DHRgr2JCG3YxGjVd3MapjSSPCSMT7C dcymDAylEUkb2Cg31D9rZHY+az0xM4/IrdPCfy3d9es/HUxT8dLXdeyFWGd/bEKWa7qu pp4qp3+/u8XJbv4wXDlFAteHHqTxe/ZqlC38A8TuekES/xj5DwLxHRmS/V0EQgp/ye3u SDvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712776179; x=1713380979; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bIo2EVourWrLaohp5j6QNkkQsISAFdO4wMswAJKmsJ4=; b=iMPijGkWwN8tCUxXdUxx+I87Y8cwpoGvdqYhXE17JwtQUKpjKEgWHb27y4h18bKVN1 9+EcexhHgGidTlzS1tScCVYqULsajdx4b7fPgijds3RvFsWnevjvJdYIg+GzY6tOoOu7 W1LM8bLP1TrXPVvxG4pNkUrDnN8+QOJgX7XBe3k42y/Z/MRO3yZ1o/Fh9zONZZi9xAST dVbk2FUtlF81/lYyegQ3Q8S59zcUDv6Qukg8Z0TKQNoIzKfst4dKehJ3OSxC/5Evcl8T zc2cTR/8KQznu9bYJt0x1AZTCMd7GIVptMTAg4wgqloVoFjM9kwkdzdt1yLVu/RmoTDD FZHA== X-Forwarded-Encrypted: i=1; AJvYcCV5LTSvHW7ChyemAZ0ZtWbag0Fryy/BwRxHZ2ukvJXJD2J4b45T5soWvdyAZsO/iz9o55Hz3/sEfFSLPCIytUprEDWrsh8xmKECQUFK X-Gm-Message-State: AOJu0YynrnOYFKAp/IL/+aP1XwbUG9J9Uz2xHDhMXsXHvORjpuL304Fy hAWOQAxigKHAqQSojHVgVznatNl10/vSyUVzvuaUeR53X1q8VTxUy5uI1q3Rr/DdVgHfmM/4AOn GgoxLf7MVAE01xFT2Dwi/HmzlbE7cbVUas0/y X-Received: by 2002:a05:6512:33cb:b0:517:854e:2c91 with SMTP id d11-20020a05651233cb00b00517854e2c91mr925647lfg.64.1712776178375; Wed, 10 Apr 2024 12:09:38 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240408153000.2152844-1-almasrymina@google.com> <20240408153000.2152844-3-almasrymina@google.com> <20240409182301.227c9ff7@kernel.org> In-Reply-To: <20240409182301.227c9ff7@kernel.org> From: Mina Almasry Date: Wed, 10 Apr 2024 12:09:26 -0700 Message-ID: Subject: Re: [PATCH net-next v5 2/3] net: mirror skb frag ref/unref helpers To: Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ayush Sawal , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Steffen Klassert , Herbert Xu , David Ahern , Boris Pismenny , John Fastabend , Dragos Tatulea Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2024 at 6:23=E2=80=AFPM Jakub Kicinski wro= te: > > On Mon, 8 Apr 2024 08:29:57 -0700 Mina Almasry wrote: > > +#ifdef CONFIG_PAGE_POOL > > +static inline bool is_pp_page(struct page *page) > > +{ > > + return (page->pp_magic & ~0x3UL) =3D=3D PP_SIGNATURE; > > +} > > + > > +/* page_pool_unref_page() lives in net/page_pool/helpers.h */ > > +static inline void page_pool_ref_page(struct page *page) > > +{ > > + atomic_long_inc(&page->pp_ref_count); > > +} > > + > > +static inline bool napi_pp_get_page(struct page *page) > > +{ > > + page =3D compound_head(page); > > + > > + if (!is_pp_page(page)) > > + return false; > > + > > + page_pool_ref_page(page); > > + return true; > > +} > > +#endif > > + > > +static inline void skb_page_ref(struct page *page, bool recycle) > > +{ > > +#ifdef CONFIG_PAGE_POOL > > + if (recycle && napi_pp_get_page(page)) > > + return; > > +#endif > > + get_page(page); > > +} > > Shifting of all this code from pp to skbuff catches the eye. > There aren't that many callers to these, can we start a new header? I am not 100% sure what the new header should be named and what exactly you wanted moved to the new header, but made a guess and uploaded v6 with this change. Let me know if it's not what you had in mind. I added a new linux/skbuff_ref.h header file, moved all the ref functions there, and included page pool headers in that without worry. v6: https://patchwork.kernel.org/project/netdevbpf/list/?series=3D843380 > We can then include page pool headers in the without worry. > > I'll apply the other patches, they look independent. --=20 Thanks, Mina