* [PATCH net] octeontx2-pf: Set page pool size
@ 2023-08-10 2:44 Ratheesh Kannoth
2023-08-10 17:09 ` Alexander Lobakin
0 siblings, 1 reply; 4+ messages in thread
From: Ratheesh Kannoth @ 2023-08-10 2:44 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem,
edumazet, kuba, pabeni, Ratheesh Kannoth, Alexander Lobakin
page pool infra does direct recycling aggressively.
This would often keep ptr_ring left unused. Save
memory by configuring ptr_ring to a constant value(2K).
Please find discussion at
https://lore.kernel.org/netdev/
15d32b22-22b0-64e3-a49e-88d780c24616@kernel.org/T/
Fixes: b2e3406a38f0 ("octeontx2-pf: Add support for page pool")
Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 77c8f650f7ac..123348a9e19e 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -1432,7 +1432,8 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
}
pp_params.flags = PP_FLAG_PAGE_FRAG | PP_FLAG_DMA_MAP;
- pp_params.pool_size = numptrs;
+#define OTX2_PAGE_POOL_SZ 2048
+ pp_params.pool_size = OTX2_PAGE_POOL_SZ;
pp_params.nid = NUMA_NO_NODE;
pp_params.dev = pfvf->dev;
pp_params.dma_dir = DMA_FROM_DEVICE;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] octeontx2-pf: Set page pool size
2023-08-10 2:44 [PATCH net] octeontx2-pf: Set page pool size Ratheesh Kannoth
@ 2023-08-10 17:09 ` Alexander Lobakin
2023-08-10 17:59 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Lobakin @ 2023-08-10 17:09 UTC (permalink / raw)
To: Ratheesh Kannoth
Cc: netdev, linux-kernel, sgoutham, lcherian, gakula, jerinj, hkelam,
sbhatta, davem, edumazet, kuba, pabeni
From: Ratheesh Kannoth <rkannoth@marvell.com>
Date: Thu, 10 Aug 2023 08:14:22 +0530
> page pool infra does direct recycling aggressively.
> This would often keep ptr_ring left unused. Save
> memory by configuring ptr_ring to a constant value(2K).
>
> Please find discussion at
> https://lore.kernel.org/netdev/
> 15d32b22-22b0-64e3-a49e-88d780c24616@kernel.org/T/
>
> Fixes: b2e3406a38f0 ("octeontx2-pf: Add support for page pool")
Now the commit message doesn't explain why this is a fix.
The subject is also ambigous.
In the subject, you need to say clearly what you're fixing. E.g. "fix
page_pool creation fail for rings > 32k".
In the commitmsg, provide the actual kernel warning/error and explain
some implementation details, like: "instead of clamping page_pool size
to 32k at most, limit it even more to 2k to avoid wasting memory on much
less used now ptr_ring".
> Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> index 77c8f650f7ac..123348a9e19e 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> @@ -1432,7 +1432,8 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
> }
>
> pp_params.flags = PP_FLAG_PAGE_FRAG | PP_FLAG_DMA_MAP;
> - pp_params.pool_size = numptrs;
> +#define OTX2_PAGE_POOL_SZ 2048
> + pp_params.pool_size = OTX2_PAGE_POOL_SZ;
And if the ring size is e.g. 256 or 512 or even 1024, why have Page Pool
with 2048 elements? Should be something like
min(numptrs, OTX2_PAGE_POOL_MAX_SZ)
And please place the definition somewhere next to other definitions at
the top of the file or in some header, dunno. Placing it inside the
function almost guarantees you won't be able to find it one day.
> pp_params.nid = NUMA_NO_NODE;
> pp_params.dev = pfvf->dev;
> pp_params.dma_dir = DMA_FROM_DEVICE;
Thanks,
Olek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] octeontx2-pf: Set page pool size
2023-08-10 17:09 ` Alexander Lobakin
@ 2023-08-10 17:59 ` Jakub Kicinski
2023-08-11 1:55 ` [EXT] " Ratheesh Kannoth
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2023-08-10 17:59 UTC (permalink / raw)
To: Alexander Lobakin
Cc: Ratheesh Kannoth, netdev, linux-kernel, sgoutham, lcherian,
gakula, jerinj, hkelam, sbhatta, davem, edumazet, pabeni
On Thu, 10 Aug 2023 19:09:21 +0200 Alexander Lobakin wrote:
> And if the ring size is e.g. 256 or 512 or even 1024, why have Page Pool
> with 2048 elements? Should be something like
>
> min(numptrs, OTX2_PAGE_POOL_MAX_SZ)
And someone needs to tell me why the 2k was chosen as a value that
uniquely fits this device but not other devices..
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [EXT] Re: [PATCH net] octeontx2-pf: Set page pool size
2023-08-10 17:59 ` Jakub Kicinski
@ 2023-08-11 1:55 ` Ratheesh Kannoth
0 siblings, 0 replies; 4+ messages in thread
From: Ratheesh Kannoth @ 2023-08-11 1:55 UTC (permalink / raw)
To: Jakub Kicinski, Alexander Lobakin
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sunil Kovvuri Goutham, Linu Cherian, Geethasowjanya Akula,
Jerin Jacob Kollanukkaran, Hariprasad Kelam,
Subbaraya Sundeep Bhatta, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Thursday, August 10, 2023 11:30 PM
> To: Alexander Lobakin <aleksander.lobakin@intel.com>
> > min(numptrs, OTX2_PAGE_POOL_MAX_SZ)
>
> And someone needs to tell me why the 2k was chosen as a value that
> uniquely fits this device but not other devices..
Would i move this macro ( min(numptrs, PAGE_POOL_MAX_SZ) ) to page_pool_init() ?
-Ratheesh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-11 1:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 2:44 [PATCH net] octeontx2-pf: Set page pool size Ratheesh Kannoth
2023-08-10 17:09 ` Alexander Lobakin
2023-08-10 17:59 ` Jakub Kicinski
2023-08-11 1:55 ` [EXT] " Ratheesh Kannoth
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).