From: Yunsheng Lin <hidden> Date: 2021-08-20 02:07:51
Patch 1: Use relexed atomic for release side accounting
Patch 2: Minor optimize for page_pool_dma_map() function
Yunsheng Lin (2):
page_pool: use relexed atomic for release side accounting
page_pool: optimize the cpu sync operation when DMA mapping
net/core/page_pool.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--
2.7.4
From: Yunsheng Lin <hidden> Date: 2021-08-20 02:07:49
There is no need to synchronize the account updating, so
use the relexed atomic to avoid some memory barrier in the
data path.
Signed-off-by: Yunsheng Lin <redacted>
---
net/core/page_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -370,7 +370,7 @@ void page_pool_release_page(struct page_pool *pool, struct page *page)/* This may be the last page returned, releasing the pool, so*itisnotsafetoreferencepoolafterwards.*/-count=atomic_inc_return(&pool->pages_state_release_cnt);+count=atomic_inc_return_relaxed(&pool->pages_state_release_cnt);trace_page_pool_state_release(pool,page,count);}EXPORT_SYMBOL(page_pool_release_page);
From: Yunsheng Lin <hidden> Date: 2021-08-20 02:07:51
If the DMA_ATTR_SKIP_CPU_SYNC is not set, cpu syncing is
also done in dma_map_page_attrs(), so set the attrs according
to pool->p.flags to avoid calling dma sync function again.
Also mark the dma error as the unlikely case While we are at
it.
Signed-off-by: Yunsheng Lin <redacted>
---
net/core/page_pool.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
If the DMA_ATTR_SKIP_CPU_SYNC is not set, cpu syncing is
also done in dma_map_page_attrs(), so set the attrs according
to pool->p.flags to avoid calling dma sync function again.
Also mark the dma error as the unlikely case While we are at
it.
This shouldn't be needed. dma_mapping_error() will be (most likely)
inlined by the compiler, and it includes the unlikely() hint.
From: Yunsheng Lin <hidden> Date: 2021-08-20 06:29:55
On 2021/8/20 14:10, Heiner Kallweit wrote:
On 20.08.2021 04:06, Yunsheng Lin wrote:
quoted
If the DMA_ATTR_SKIP_CPU_SYNC is not set, cpu syncing is
also done in dma_map_page_attrs(), so set the attrs according
to pool->p.flags to avoid calling dma sync function again.
Also mark the dma error as the unlikely case While we are at
it.
This shouldn't be needed. dma_mapping_error() will be (most likely)
inlined by the compiler, and it includes the unlikely() hint.
Good point, will remove the unlikely() mark.
Thanks.