[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230620083918.2e3dbade@kernel.org>
Date: Tue, 20 Jun 2023 08:39:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jesper Dangaard Brouer <jbrouer@...hat.com>
Cc: brouer@...hat.com, Alexander Duyck <alexander.duyck@...il.com>, Yunsheng
Lin <linyunsheng@...wei.com>, davem@...emloft.net, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Lorenzo Bianconi
<lorenzo@...nel.org>, Yisen Zhuang <yisen.zhuang@...wei.com>, Salil Mehta
<salil.mehta@...wei.com>, Eric Dumazet <edumazet@...gle.com>, Sunil Goutham
<sgoutham@...vell.com>, Geetha sowjanya <gakula@...vell.com>, Subbaraya
Sundeep <sbhatta@...vell.com>, hariprasad <hkelam@...vell.com>, Saeed
Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>, Felix
Fietkau <nbd@....name>, Ryder Lee <ryder.lee@...iatek.com>, Shayne Chen
<shayne.chen@...iatek.com>, Sean Wang <sean.wang@...iatek.com>, Kalle Valo
<kvalo@...nel.org>, Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Jesper Dangaard Brouer <hawk@...nel.org>, Ilias Apalodimas
<ilias.apalodimas@...aro.org>, linux-rdma@...r.kernel.org,
linux-wireless@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, Jonathan Lemon
<jonathan.lemon@...il.com>
Subject: Re: Memory providers multiplexing (Was: [PATCH net-next v4 4/5]
page_pool: remove PP_FLAG_PAGE_FRAG flag)
On Tue, 20 Jun 2023 17:12:41 +0200 Jesper Dangaard Brouer wrote:
> > The workaround solution I had in mind would be to create a narrower API
> > for just data pages. Since we'd need to sprinkle ifs anyway, pull them
> > up close to the call site. Allowing to switch page pool for a
> > completely different implementation, like the one Jonathan coded up for
> > iouring. Basically
> >
> > $name_alloc_page(queue)
> > {
> > if (queue->pp)
> > return page_pool_dev_alloc_pages(queue->pp);
> > else if (queue->iouring..)
> > ...
> > }
>
> Yes, this is more the direction I'm thinking.
> In many cases, you don't need this if-statement helper in the driver, as
> driver RX side code will know the API used upfront.
Meaning that the driver "knows" if it's in the XDP, AF_XDP, iouring
or "normal" Rx path? I hope we can avoid extra code in the driver
completely, for data pages.
> The TX completion side will need this kind of multiplexing return
> helper, to return the pages to the correct memory allocator type (e.g.
> page_pool being one). See concept in [1] __xdp_return().
>
> Performance wise, function pointers are slow due to RETPOLINE, but
> switch-case statements (below certain size) becomes a jump table, which
> is fast. See[1].
>
> [1] https://elixir.bootlin.com/linux/v6.4-rc7/source/net/core/xdp.c#L377
SG!
> Regarding room in "struct page", notice that page->pp_magic will have
> plenty room for e.g. storing xdp_mem_type or even xdp_mem_info (which
> also contains an ID).
I was worried about fitting the DMA address, if the pages code from user
space.
Powered by blists - more mailing lists