All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message
@ 2019-03-12  9:35 Wentao Cai
  2019-03-12 10:18 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Wentao Cai @ 2019-03-12  9:35 UTC (permalink / raw)
  To: gregkh; +Cc: outreachy-kernel, Wentao Cai

Remove unnecessary 'out of memory' message to silence checkpatch.pl
warning:
WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Wentao Cai <etsai042@gmail.com>
---
 drivers/staging/netlogic/xlr_net.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
index 8554fcf4321b..10f14a5cf490 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -185,10 +185,8 @@ static int xlr_net_fill_rx_ring(struct net_device *ndev)
 
 	for (i = 0; i < MAX_FRIN_SPILL / 4; i++) {
 		skb_data = xlr_alloc_skb();
-		if (!skb_data) {
-			netdev_err(ndev, "SKB allocation failed\n");
+		if (!skb_data)
 			return -ENOMEM;
-		}
 		send_to_rfr_fifo(priv, skb_data);
 	}
 	netdev_info(ndev, "Rx ring setup done\n");
-- 
2.11.0



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

* Re: [Outreachy kernel] [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message
  2019-03-12  9:35 [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message Wentao Cai
@ 2019-03-12 10:18 ` Julia Lawall
  2019-03-12 15:30   ` etsai042
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-03-12 10:18 UTC (permalink / raw)
  To: Wentao Cai; +Cc: gregkh, outreachy-kernel



On Tue, 12 Mar 2019, Wentao Cai wrote:

> Remove unnecessary 'out of memory' message to silence checkpatch.pl
> warning:
> WARNING: Possible unnecessary 'out of memory' message

A better log message would explain why the message is not necessary.  I
guess that if you unfold this, you will end up at kmalloc, which provides
a backtrace on failure, so the message is not very useful.  But you should
trace thrugh the definition to see that this is actually what happens.

julia

>
> Signed-off-by: Wentao Cai <etsai042@gmail.com>
> ---
>  drivers/staging/netlogic/xlr_net.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
> index 8554fcf4321b..10f14a5cf490 100644
> --- a/drivers/staging/netlogic/xlr_net.c
> +++ b/drivers/staging/netlogic/xlr_net.c
> @@ -185,10 +185,8 @@ static int xlr_net_fill_rx_ring(struct net_device *ndev)
>
>  	for (i = 0; i < MAX_FRIN_SPILL / 4; i++) {
>  		skb_data = xlr_alloc_skb();
> -		if (!skb_data) {
> -			netdev_err(ndev, "SKB allocation failed\n");
> +		if (!skb_data)
>  			return -ENOMEM;
> -		}
>  		send_to_rfr_fifo(priv, skb_data);
>  	}
>  	netdev_info(ndev, "Rx ring setup done\n");
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190312093511.3789-1-etsai042%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message
  2019-03-12 10:18 ` [Outreachy kernel] " Julia Lawall
@ 2019-03-12 15:30   ` etsai042
  2019-03-12 15:58     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: etsai042 @ 2019-03-12 15:30 UTC (permalink / raw)
  To: outreachy-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2448 bytes --]



On Tuesday, March 12, 2019 at 5:14:30 AM UTC-7, Julia Lawall wrote:
>
>
>
> A better log message would explain why the message is not necessary.  I 
> guess that if you unfold this, you will end up at kmalloc, which provides 
> a backtrace on failure, so the message is not very useful.  But you should 
> trace thrugh the definition to see that this is actually what happens. 
>

I traced down the memory alloc function to alloc_skb (network buffer 
alloc), all the way down to kmem_cache_alloc, which had 
a trace_kmem_cache_alloc function to provide a skb alloc trace.
I understand that "out of memory" message can be found in the stack dump 
done by the memory subsystem. Thus this "out of memory" error is 
unnecessary. But I don't know how to present this in log message.
Is "Delete netdev_err since generic message can be found in stack dump" 
good for this?

Wentao
   
 

> julia 
>
> > 
> > Signed-off-by: Wentao Cai <etsa...@gmail.com <javascript:>> 
> > --- 
> >  drivers/staging/netlogic/xlr_net.c | 4 +--- 
> >  1 file changed, 1 insertion(+), 3 deletions(-) 
> > 
> > diff --git a/drivers/staging/netlogic/xlr_net.c 
> b/drivers/staging/netlogic/xlr_net.c 
> > index 8554fcf4321b..10f14a5cf490 100644 
> > --- a/drivers/staging/netlogic/xlr_net.c 
> > +++ b/drivers/staging/netlogic/xlr_net.c 
> > @@ -185,10 +185,8 @@ static int xlr_net_fill_rx_ring(struct net_device 
> *ndev) 
> > 
> >          for (i = 0; i < MAX_FRIN_SPILL / 4; i++) { 
> >                  skb_data = xlr_alloc_skb(); 
> > -                if (!skb_data) { 
> > -                        netdev_err(ndev, "SKB allocation failed\n"); 
> > +                if (!skb_data) 
> >                          return -ENOMEM; 
> > -                } 
> >                  send_to_rfr_fifo(priv, skb_data); 
> >          } 
> >          netdev_info(ndev, "Rx ring setup done\n"); 
> > -- 
> > 2.11.0 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "outreachy-kernel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to outreachy-kern...@googlegroups.com <javascript:>. 
> > To post to this group, send email to outreach...@googlegroups.com 
> <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20190312093511.3789-1-etsai042%40gmail.com. 
>
> > For more options, visit https://groups.google.com/d/optout. 
> > 
>

[-- Attachment #1.2: Type: text/html, Size: 4549 bytes --]

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

* Re: [Outreachy kernel] [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message
  2019-03-12 15:30   ` etsai042
@ 2019-03-12 15:58     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2019-03-12 15:58 UTC (permalink / raw)
  To: etsai042; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 3647 bytes --]



On Tue, 12 Mar 2019, etsai042@gmail.com wrote:

>
>
> On Tuesday, March 12, 2019 at 5:14:30 AM UTC-7, Julia Lawall wrote:
>
>
>       A better log message would explain why the message is not necessary. ï¿œI
>       guess that if you unfold this, you will end up at kmalloc, which provides
>       a backtrace on failure, so the message is not very useful. ï¿œBut you should
>       trace thrugh the definition to see that this is actually what happens.ᅵ
>
>
> I traced down the memory alloc function toï¿œalloc_skb (network buffer alloc), all the way down to kmem_cache_alloc, which had aï¿œtrace_kmem_cache_alloc function to provide a skb alloc trace.
> I understand that "out of memory" message can be found in the stack dump done by the memory subsystem. Thus this "out of memory" error is unnecessary. But I don't know how to present this in log message.
> Is "Deleteï¿œnetdev_errï¿œsince generic message can be found in stack dump" good for this?

OK, I'm not really sure where the backtrace is actually generated.
Perhaps it would be better to say nothing than something incorrect.

julia

>
> Wentao
> ᅵᅵᅵ
> ᅵ
>       julia
>
>       >
>       > Signed-off-by: Wentao Cai <etsa...@gmail.com>
>       > ---
>       > ï¿œdrivers/staging/netlogic/xlr_net.c | 4 +---
>       > ᅵ1 file changed, 1 insertion(+), 3 deletions(-)
>       >
>       > diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
>       > index 8554fcf4321b..10f14a5cf490 100644
>       > --- a/drivers/staging/netlogic/xlr_net.c
>       > +++ b/drivers/staging/netlogic/xlr_net.c
>       > @@ -185,10 +185,8 @@ static int xlr_net_fill_rx_ring(struct net_device *ndev)
>       >
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵfor (i = 0; i < MAX_FRIN_SPILL / 4; i++) {
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵskb_data = xlr_alloc_skb();
>       > -ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵif (!skb_data) {
>       > -ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵnetdev_err(ndev, "SKB allocation failed\n");
>       > +ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵif (!skb_data)
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵreturn -ENOMEM;
>       > -ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ}
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵsend_to_rfr_fifo(priv, skb_data);
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵ}
>       > ᅵᅵᅵᅵᅵᅵᅵᅵᅵnetdev_info(ndev, "Rx ring setup done\n");
>       > --
>       > 2.11.0
>       >
>       > --
>       > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>       > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kern...@googlegroups.com.
>       > To post to this group, send email to outreach...@googlegroups.com.
>       > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190312093511.3789-1-etsai042%40gmail.com.
>       > For more options, visit https://groups.google.com/d/optout.
>       >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/c09680e5-0bce-4c70-b601-4dd1a6b0d215%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

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

end of thread, other threads:[~2019-03-12 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  9:35 [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message Wentao Cai
2019-03-12 10:18 ` [Outreachy kernel] " Julia Lawall
2019-03-12 15:30   ` etsai042
2019-03-12 15:58     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.