Thread (29 messages) flat view 29 messages, 5 authors, 2023-08-18

Re: [RFC net-next 02/13] net: page_pool: avoid touching slow on the fastpath

From: Mina Almasry <hidden>
Date: 2023-08-17 21:31:59

On Wed, Aug 16, 2023 at 4:43 PM Jakub Kicinski [off-list ref] wrote:
quoted hunk ↗ jump to hunk
To fully benefit from previous commit add one byte of state
in the first cache line recording if we need to look at
the slow part.

The packing isn't all that impressive right now, we create
a 7B hole. I'm expecting Olek's rework will reshuffle this,
anyway.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/net/page_pool/types.h | 2 ++
 net/core/page_pool.c          | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 1c16b95de62f..1ac7ce25fbd4 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -127,6 +127,8 @@ struct page_pool_stats {
 struct page_pool {
        struct page_pool_params_fast p;

+       bool has_init_callback;
+
Nit: I wonder if it's slightly more appropriate for this to be
has_slow, given how I understand the intent of usage, but it doesn't
really matter. Either way,:

Reviewed-by: Mina Almasry <redacted>
quoted hunk ↗ jump to hunk
        long frag_users;
        struct page *frag_page;
        unsigned int frag_offset;
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index ffe7782d7fc0..2c14445a353a 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -216,6 +216,8 @@ static int page_pool_init(struct page_pool *pool,
            pool->p.flags & PP_FLAG_PAGE_FRAG)
                return -EINVAL;

+       pool->has_init_callback = !!pool->slow.init_callback;
+
 #ifdef CONFIG_PAGE_POOL_STATS
        pool->recycle_stats = alloc_percpu(struct page_pool_recycle_stats);
        if (!pool->recycle_stats)
@@ -373,7 +375,7 @@ static void page_pool_set_pp_info(struct page_pool *pool,
 {
        page->pp = pool;
        page->pp_magic |= PP_SIGNATURE;
-       if (pool->slow.init_callback)
+       if (pool->has_init_callback)
                pool->slow.init_callback(page, pool->slow.init_arg);
 }

--
2.41.0

-- 
Thanks,
Mina
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help