mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 23:51:39 +00:00
net: page_pool: split the page_pool_params into fast and slow
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. Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Reviewed-by: Mina Almasry <almasrymina@google.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Link: https://lore.kernel.org/r/20231121000048.789613-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3a17ea77da
commit
5027ec19f1
@ -54,6 +54,7 @@ struct pp_alloc_cache {
|
|||||||
* @offset: DMA sync address offset for PP_FLAG_DMA_SYNC_DEV
|
* @offset: DMA sync address offset for PP_FLAG_DMA_SYNC_DEV
|
||||||
*/
|
*/
|
||||||
struct page_pool_params {
|
struct page_pool_params {
|
||||||
|
struct_group_tagged(page_pool_params_fast, fast,
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned int order;
|
unsigned int order;
|
||||||
unsigned int pool_size;
|
unsigned int pool_size;
|
||||||
@ -63,9 +64,12 @@ struct page_pool_params {
|
|||||||
enum dma_data_direction dma_dir;
|
enum dma_data_direction dma_dir;
|
||||||
unsigned int max_len;
|
unsigned int max_len;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
);
|
||||||
|
struct_group_tagged(page_pool_params_slow, slow,
|
||||||
/* private: used by test code only */
|
/* private: used by test code only */
|
||||||
void (*init_callback)(struct page *page, void *arg);
|
void (*init_callback)(struct page *page, void *arg);
|
||||||
void *init_arg;
|
void *init_arg;
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PAGE_POOL_STATS
|
#ifdef CONFIG_PAGE_POOL_STATS
|
||||||
@ -119,7 +123,7 @@ struct page_pool_stats {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct page_pool {
|
struct page_pool {
|
||||||
struct page_pool_params p;
|
struct page_pool_params_fast p;
|
||||||
|
|
||||||
long frag_users;
|
long frag_users;
|
||||||
struct page *frag_page;
|
struct page *frag_page;
|
||||||
@ -178,6 +182,9 @@ struct page_pool {
|
|||||||
refcount_t user_cnt;
|
refcount_t user_cnt;
|
||||||
|
|
||||||
u64 destroy_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);
|
struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
|
||||||
|
@ -173,7 +173,8 @@ static int page_pool_init(struct page_pool *pool,
|
|||||||
{
|
{
|
||||||
unsigned int ring_qsize = 1024; /* Default */
|
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 */
|
/* Validate only known flags were used */
|
||||||
if (pool->p.flags & ~(PP_FLAG_ALL))
|
if (pool->p.flags & ~(PP_FLAG_ALL))
|
||||||
@ -388,8 +389,8 @@ static void page_pool_set_pp_info(struct page_pool *pool,
|
|||||||
* the overhead is negligible.
|
* the overhead is negligible.
|
||||||
*/
|
*/
|
||||||
page_pool_fragment_page(page, 1);
|
page_pool_fragment_page(page, 1);
|
||||||
if (pool->p.init_callback)
|
if (pool->slow.init_callback)
|
||||||
pool->p.init_callback(page, pool->p.init_arg);
|
pool->slow.init_callback(page, pool->slow.init_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void page_pool_clear_pp_info(struct page *page)
|
static void page_pool_clear_pp_info(struct page *page)
|
||||||
|
Loading…
Reference in New Issue
Block a user