From: Jakub Kicinski <kuba@kernel.org>
To: netdev@vger.kernel.org
Cc: hawk@kernel.org, ilias.apalodimas@linaro.org,
aleksander.lobakin@intel.com, linyunsheng@huawei.com,
almasrymina@google.com, Jakub Kicinski <kuba@kernel.org>
Subject: [RFC net-next 01/13] net: page_pool: split the page_pool_params into fast and slow
Date: Wed, 16 Aug 2023 16:42:50 -0700 [thread overview]
Message-ID: <20230816234303.3786178-2-kuba@kernel.org> (raw)
In-Reply-To: <20230816234303.3786178-1-kuba@kernel.org>
struct page_pool is rather performance critical and we use
16B of the first cache line to store 2 pointers used only
by test code. Future patches will add more informational
(non-fast path) attributes.
It's convenient for the user of the API to not have to worry
which fields are fast and which are slow path. Use struct
groups to split the params into the two categories internally.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/net/page_pool/types.h | 31 +++++++++++++++++++------------
net/core/page_pool.c | 7 ++++---
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 887e7946a597..1c16b95de62f 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -56,18 +56,22 @@ struct pp_alloc_cache {
* @offset: DMA sync address offset for PP_FLAG_DMA_SYNC_DEV
*/
struct page_pool_params {
- unsigned int flags;
- unsigned int order;
- unsigned int pool_size;
- int nid;
- struct device *dev;
- struct napi_struct *napi;
- enum dma_data_direction dma_dir;
- unsigned int max_len;
- unsigned int offset;
+ struct_group_tagged(page_pool_params_fast, fast,
+ unsigned int flags;
+ unsigned int order;
+ unsigned int pool_size;
+ int nid;
+ struct device *dev;
+ struct napi_struct *napi;
+ enum dma_data_direction dma_dir;
+ unsigned int max_len;
+ unsigned int offset;
+ );
+ struct_group_tagged(page_pool_params_slow, slow,
/* private: used by test code only */
- void (*init_callback)(struct page *page, void *arg);
- void *init_arg;
+ void (*init_callback)(struct page *page, void *arg);
+ void *init_arg;
+ );
};
#ifdef CONFIG_PAGE_POOL_STATS
@@ -121,7 +125,7 @@ struct page_pool_stats {
#endif
struct page_pool {
- struct page_pool_params p;
+ struct page_pool_params_fast p;
long frag_users;
struct page *frag_page;
@@ -180,6 +184,9 @@ struct page_pool {
refcount_t user_cnt;
u64 destroy_cnt;
+
+ /* Slow/Control-path information follows */
+ struct page_pool_params_slow slow;
};
struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 77cb75e63aca..ffe7782d7fc0 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -173,7 +173,8 @@ static int page_pool_init(struct page_pool *pool,
{
unsigned int ring_qsize = 1024; /* Default */
- memcpy(&pool->p, params, sizeof(pool->p));
+ memcpy(&pool->p, ¶ms->fast, sizeof(pool->p));
+ memcpy(&pool->slow, ¶ms->slow, sizeof(pool->slow));
/* Validate only known flags were used */
if (pool->p.flags & ~(PP_FLAG_ALL))
@@ -372,8 +373,8 @@ static void page_pool_set_pp_info(struct page_pool *pool,
{
page->pp = pool;
page->pp_magic |= PP_SIGNATURE;
- if (pool->p.init_callback)
- pool->p.init_callback(page, pool->p.init_arg);
+ if (pool->slow.init_callback)
+ pool->slow.init_callback(page, pool->slow.init_arg);
}
static void page_pool_clear_pp_info(struct page *page)
--
2.41.0
next prev parent reply other threads:[~2023-08-16 23:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 23:42 [RFC net-next 00/13] net: page_pool: add netlink-based introspection Jakub Kicinski
2023-08-16 23:42 ` Jakub Kicinski [this message]
2023-08-17 9:31 ` [RFC net-next 01/13] net: page_pool: split the page_pool_params into fast and slow Jesper Dangaard Brouer
2023-08-17 9:35 ` Ilias Apalodimas
2023-08-17 21:28 ` Mina Almasry
2023-08-16 23:42 ` [RFC net-next 02/13] net: page_pool: avoid touching slow on the fastpath Jakub Kicinski
2023-08-17 9:32 ` Jesper Dangaard Brouer
2023-08-17 9:38 ` Ilias Apalodimas
2023-08-17 21:31 ` Mina Almasry
2023-08-16 23:42 ` [RFC net-next 03/13] net: page_pool: factor out uninit Jakub Kicinski
2023-08-17 7:40 ` Ilias Apalodimas
2023-08-17 16:25 ` Jakub Kicinski
2023-08-17 16:53 ` Ilias Apalodimas
2023-08-16 23:42 ` [RFC net-next 04/13] net: page_pool: id the page pools Jakub Kicinski
2023-08-17 21:56 ` Mina Almasry
2023-08-18 0:08 ` Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 05/13] net: page_pool: record pools per netdev Jakub Kicinski
2023-08-17 7:26 ` Simon Horman
2023-08-17 16:22 ` Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 06/13] net: page_pool: stash the NAPI ID for easier access Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 07/13] eth: link netdev to pp Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 08/13] net: page_pool: add nlspec for basic access to page pools Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 09/13] net: page_pool: implement GET in the netlink API Jakub Kicinski
2023-08-16 23:42 ` [RFC net-next 10/13] net: page_pool: add netlink notifications for state changes Jakub Kicinski
2023-08-16 23:43 ` [RFC net-next 11/13] net: page_pool: report when page pool was destroyed Jakub Kicinski
2023-08-16 23:43 ` [RFC net-next 12/13] net: page_pool: expose page pool stats via netlink Jakub Kicinski
2023-08-16 23:43 ` [RFC net-next 13/13] tools: netdev: regen after page pool changes Jakub Kicinski
2023-08-17 21:21 ` [RFC net-next 00/13] net: page_pool: add netlink-based introspection Mina Almasry
2023-08-18 0:13 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230816234303.3786178-2-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=almasrymina@google.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=linyunsheng@huawei.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).