Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp143584lqe; Tue, 9 Apr 2024 18:23:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWB/X06VAB9vfBMKFqjUNrPJeABOoVJcHGfQ2jg7k9/qPgimbM1+ad/OxgZoXRYOyn7P0Dno/k9LmIvJXTEMfjKAdeQVUz49kNYLCSsdQ== X-Google-Smtp-Source: AGHT+IEVbLh+lURm6dLjKxZ4HIOUy6s4MblV+a0yNna1EsXgoHzv6MY0dRVHgfDZsEtNO5E50ZBK X-Received: by 2002:a17:903:11c3:b0:1e4:9bce:9d75 with SMTP id q3-20020a17090311c300b001e49bce9d75mr1604278plh.65.1712712199194; Tue, 09 Apr 2024 18:23:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712712199; cv=pass; d=google.com; s=arc-20160816; b=j5kM1eWQ/qsi0vvoPbUmz4l723ZAlu6YUJsh06J/Lxy3FhzMhtrJD16iJ1+iYQ7B3Z voVyzxFIWw0vDAwRyc+EGV6qCuidqJL5n60A9+XnFwfqSTzliQe//DWr/soZBAsJfWyi EF0iZ4fVhTKNBtpTSjeDG5Q/TD20RbLJpfnea5gswPzHQk5z7wo6DECXwb9lFBUQbfP9 RoFsTlLi1QgnOyYEpH45rw3PSNkFS0cJ+tMpmKBmDamdW08u9q1wE1eAJ8bkikJecHzH T7gDPZw43V7USHdGy5vOLWEi2aysRpP8FBrpCBH5WCM53tWFliq5dlOARlvgagf3SQIS Vobg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=JAb/m1gbCDRTCkNF8TQYgiJYN0eHY0Gzm/its6cVJrU=; fh=XujwUecLJ2ayjtMdX554izINBH7lZEnpfLbNR92zeSE=; b=ipDH+gBcNlD+0yUVpj2imk65Uuxa7jtsTOcfES73nhPAW+4OGCvPaHALFhXmfduN6v 15KZRgGxsCJR3ny+x8LJ1IXrG+4HKLOxtTfQyzXkbFW/gYR5Yiv3PqjK5N+uQ4ffVGsF DqpO3MoFo6dRJbFBZIeamxy6fHYlIeaDn0Hk0qgO/WdvEA+mOJfkFJ8LcSQevnFGcteQ 8qjFs7UU9BFKG99gctfFnc0n1pgB1p5sDbJyCkD6BkqSu+3xggg1iu6WpS9mumIUqeF6 hykaLk3IPhhHgFP2qgzHm9PXrw1PMmIl/x9YtUvIIIYvlWSlUrfiJpeZrbiInBqjwJ5W GRtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FzKneyhx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p8-20020a170902e74800b001e3e64ed055si6937516plf.624.2024.04.09.18.23.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 18:23:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FzKneyhx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A785FB217A2 for ; Wed, 10 Apr 2024 01:23:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D416815A4; Wed, 10 Apr 2024 01:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FzKneyhx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06D13623; Wed, 10 Apr 2024 01:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712712184; cv=none; b=U9xRYlQGYSHJAr1TdL031wKGNn15S9xYxuA4Yy1jQVVgCOwmEzF1iBDvsxvF9bfL12hZDBBFFYjfgIlmkn2POcraEB+dP2P2KN+XCvik9W4FhV5jAolsHQshRC46TPdL4keZ50PZ6cYZ0bXkGBOOMKbf/sGvtK3Cv8eN0WcQcdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712712184; c=relaxed/simple; bh=gGDtkr3EW72+N26cNWxqd4eoTm7khCsAlYGmZPzNCeI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BYZdH58fWti/3x6b0L4XHzDaVjpVCRhSe6OEiSBhVQSZ0L6NHrJaES1ADvRmEX8HBcyIoShg/thW64jvmavgMVt/rQrbGfoRU+Nm0eTaIVT8daiP/f1aDD7vZxsWg26YEj5zg4fBfcdlT33eKUK5ao2HpTExeU5VBA5eEdtXxyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FzKneyhx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4AC6C433F1; Wed, 10 Apr 2024 01:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712712183; bh=gGDtkr3EW72+N26cNWxqd4eoTm7khCsAlYGmZPzNCeI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FzKneyhxcyzOmFRbLdpgjbFHy0DfjwXGlpN/ZgB+FwK6RmhTEl6QFZ/QX0I8tSHpB LX/oX8n0bPWeR7+1aJAhuF61fGuDRmemIdOJ9maF8fWJ5ZIKiFHY8Ed7eAXxVrVHyT 5Htac4d/0cySawF05grv2j19SsrmJPcFII0QZk8Eg2nwA1DelJnULbiOxAH2R9fVQx h5wrqbaCi9qgW/MxgeWPgcr79/dqYef8zKwtca/i2JXaXUdBXDRHyUlWLldsO0kYDE AODhm+DjGUtxaBi+lze0h3iokjAMWbElebTt7f2pQ0rma2Ad8m2vn6hFTDUfNhpoAx EpmskHieSvB4w== Date: Tue, 9 Apr 2024 18:23:01 -0700 From: Jakub Kicinski To: Mina Almasry 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 Subject: Re: [PATCH net-next v5 2/3] net: mirror skb frag ref/unref helpers Message-ID: <20240409182301.227c9ff7@kernel.org> In-Reply-To: <20240408153000.2152844-3-almasrymina@google.com> References: <20240408153000.2152844-1-almasrymina@google.com> <20240408153000.2152844-3-almasrymina@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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) == 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 = 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? We can then include page pool headers in the without worry. I'll apply the other patches, they look independent.