Messages in this thread | | | From | Mina Almasry <> | Date | Wed, 10 Apr 2024 12:09:26 -0700 | Subject | Re: [PATCH net-next v5 2/3] net: mirror skb frag ref/unref helpers |
| |
On Tue, Apr 9, 2024 at 6:23 PM Jakub Kicinski <kuba@kernel.org> wrote: > > 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?
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=843380
> We can then include page pool headers in the without worry. > > I'll apply the other patches, they look independent.
-- Thanks, Mina
| |