[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1dc9b2e3-65ee-aa33-d604-a758fea98eb8@huawei.com>
Date: Wed, 14 Jun 2023 20:04:39 +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>, Jonathan Corbet <corbet@....net>, Alexei
Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, John
Fastabend <john.fastabend@...il.com>, <linux-doc@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH net-next v4 5/5] page_pool: update document about frag API
On 2023/6/14 12:40, Jakub Kicinski wrote:
> On Mon, 12 Jun 2023 21:02:56 +0800 Yunsheng Lin wrote:
>> +2. page_pool_alloc_frag(): allocate memory with page splitting when driver knows
>> + that the memory it need is always smaller than or equal to half of the page
>> + allocated from page pool. Page splitting enables memory saving and thus avoid
>> + TLB/cache miss for data access, but there also is some cost to implement page
>> + splitting, mainly some cache line dirtying/bouncing for 'struct page' and
>> + atomic operation for page->pp_frag_count.
>> +
>> +3. page_pool_alloc(): allocate memory with or without page splitting depending
>> + on the requested memory size when driver doesn't know the size of memory it
>> + need beforehand. It is a mix of the above two case, so it is a wrapper of the
>> + above API to simplify driver's interface for memory allocation with least
>> + memory utilization and performance penalty.
>
> Seems like the semantics of page_pool_alloc() are always better than
> page_pool_alloc_frag(). Is there a reason to keep these two separate?
I am agree the semantics of page_pool_alloc() is better, I was thinking
about combining those two too.
The reason I am keeping it is about the nic hw with fixed buffer size for
each desc, and that buffer size is always smaller than or equal to half
of the page allocated from page pool, so it doesn't bother doing the
checking of 'size << 1 > max_size' and doesn't care about the actual
truesize.
> .
>
Powered by blists - more mailing lists