Re: [PATCH net-next v5 03/14] page_pool: avoid calling no-op externals when possible

From: Yunsheng Lin
Date: Tue Nov 28 2023 - 22:17:59 EST


On 2023/11/27 22:32, Alexander Lobakin wrote:
>
> Chris, any thoughts on a global flag for skipping DMA syncs ladder?

It seems there was one already in the past:

https://lore.kernel.org/netdev/7c55a4d7-b4aa-25d4-1917-f6f355bd722e@xxxxxxx/T/

>
>>
>>

>>> +static inline bool page_pool_set_dma_addr(const struct page_pool *pool,
>>> + struct page *page,
>>> + dma_addr_t addr)
>>> {
>>> + unsigned long val = addr;
>>> +
>>> + if (unlikely(!addr)) {
>>> + page->dma_addr = 0;
>>> + return true;
>>> + }
>>
>> The above seems unrelated change?
>
> Related. We use page_put_set_dma_addr() to clear ::dma_addr as well
> (grep for it in page_pool.c). In this case, we don't want
> dma_need_sync() to be called as we explicitly pass zero. This check
> zeroes the field and exits as quickly as possible.

The question seems to be about if we need to ensure the LSB of
page->dma_addr is not set when page_pool releases a page back to page
allocator?

> In case with the call mentioned above, zero is a compile-time constant
> there, so that this little branch will be inlined with the rest dropped.
>