netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ll_temac: Use GFP_KERNEL instead of GFP_ATOMIC when possible
@ 2022-02-16 20:16 Christophe JAILLET
  2022-02-18  5:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-02-16 20:16 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Michal Simek
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev,
	linux-arm-kernel

XTE_MAX_JUMBO_FRAME_SIZE is over 9000 bytes and the default value for
'rx_bd_num' is RX_BD_NUM_DEFAULT	(i.e. 1024)

So this loop allocates more than 9 Mo of memory.

Previous memory allocations in this function already use GFP_KERNEL, so
use __netdev_alloc_skb_ip_align() and an explicit GFP_KERNEL instead of a
implicit GFP_ATOMIC.

This gives more opportunities of successful allocation.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/xilinx/ll_temac_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index b900ab5aef2a..0547a3fde561 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -361,8 +361,9 @@ static int temac_dma_bd_init(struct net_device *ndev)
 		lp->rx_bd_v[i].next = cpu_to_be32(lp->rx_bd_p
 			+ sizeof(*lp->rx_bd_v) * ((i + 1) % lp->rx_bd_num));
 
-		skb = netdev_alloc_skb_ip_align(ndev,
-						XTE_MAX_JUMBO_FRAME_SIZE);
+		skb = __netdev_alloc_skb_ip_align(ndev,
+						  XTE_MAX_JUMBO_FRAME_SIZE,
+						  GFP_KERNEL);
 		if (!skb)
 			goto out;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ll_temac: Use GFP_KERNEL instead of GFP_ATOMIC when possible
  2022-02-16 20:16 [PATCH] net: ll_temac: Use GFP_KERNEL instead of GFP_ATOMIC when possible Christophe JAILLET
@ 2022-02-18  5:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-18  5:00 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: davem, kuba, michal.simek, linux-kernel, kernel-janitors, netdev,
	linux-arm-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Feb 2022 21:16:16 +0100 you wrote:
> XTE_MAX_JUMBO_FRAME_SIZE is over 9000 bytes and the default value for
> 'rx_bd_num' is RX_BD_NUM_DEFAULT	(i.e. 1024)
> 
> So this loop allocates more than 9 Mo of memory.
> 
> Previous memory allocations in this function already use GFP_KERNEL, so
> use __netdev_alloc_skb_ip_align() and an explicit GFP_KERNEL instead of a
> implicit GFP_ATOMIC.
> 
> [...]

Here is the summary with links:
  - net: ll_temac: Use GFP_KERNEL instead of GFP_ATOMIC when possible
    https://git.kernel.org/netdev/net-next/c/60f8ad2392d0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-18  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 20:16 [PATCH] net: ll_temac: Use GFP_KERNEL instead of GFP_ATOMIC when possible Christophe JAILLET
2022-02-18  5:00 ` patchwork-bot+netdevbpf

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).