[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84100dd1-b005-5b03-fe3e-838a08640b8e@huawei.com>
Date: Wed, 14 Jun 2023 19:55:20 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <davem@...emloft.net>, <pabeni@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Lorenzo Bianconi <lorenzo@...nel.org>,
Alexander Duyck <alexander.duyck@...il.com>, Jesper Dangaard Brouer
<hawk@...nel.org>, Ilias Apalodimas <ilias.apalodimas@...aro.org>, Eric
Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v4 2/5] page_pool: unify frag_count handling in
page_pool_is_last_frag()
On 2023/6/14 12:33, Jakub Kicinski wrote:
> On Mon, 12 Jun 2023 21:02:53 +0800 Yunsheng Lin wrote:
>> static inline void page_pool_fragment_page(struct page *page, long nr)
>> {
>> - atomic_long_set(&page->pp_frag_count, nr);
>> + if (!PAGE_POOL_DMA_USE_PP_FRAG_COUNT)
>> + atomic_long_set(&page->pp_frag_count, nr);
>
> why not let the driver take references on the page count in this case?
> I'm not saying it's worth the effort, but a comment may be useful?
I suppose page count refers to page->_refcount, right?
Page pool can only hold one reference for page->_refcount, so that
it can use that to decide if the netstack or other subsystem have
taken additional reference on that page in __page_pool_put_page():
https://elixir.bootlin.com/linux/v6.4-rc6/source/net/core/page_pool.c#L591
>
>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
>> index 9c4118c62997..69e3c5175236 100644
>> --- a/net/core/page_pool.c
>> +++ b/net/core/page_pool.c
>> @@ -352,6 +352,14 @@ static void page_pool_set_pp_info(struct page_pool *pool,
>> {
>> page->pp = pool;
>> page->pp_magic |= PP_SIGNATURE;
>> +
>> + /* Ensuring all pages have been split into one big frag initially:
>
> Again, I find the "one big frag" slightly confusing.
> Maybe we should rename pp_frag_cnt into pp_refcnt?
> After this series is looks even more like a page pool reference
> count rather than some form of number of fragments.
It depends on how you look at it, perhaps we can see page->pp_frag_count
being one as the page being split into one frag?
Using pp_refcnt may cause confusing for cases in page_pool_alloc_frag().
>
>> + * page_pool_set_pp_info() is only called once for every page when it
>> + * is allocated from the page allocator and page_pool_fragment_page()
>> + * is dirtying the same cache line as the page->pp_magic above, so
>> + * the overhead is negligible.
>> + */
>> + page_pool_fragment_page(page, 1);
>> if (pool->p.init_callback)
>> pool->p.init_callback(page, pool->p.init_arg);
>> }
>
>
> .
>
Powered by blists - more mailing lists