From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6667435589118197760 Date: Tue, 12 Mar 2019 08:30:26 -0700 (PDT) From: etsai042@gmail.com To: outreachy-kernel Message-Id: In-Reply-To: References: <20190312093511.3789-1-etsai042@gmail.com> Subject: Re: [Outreachy kernel] [PATCH] Staging: netlogic: Remove unnecessary 'out of memory' message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2812_1907279965.1552404626738" X-Google-Token: EJKhn-QFPr6grSdL5dc0 X-Google-IP: 128.199.125.193 ------=_Part_2812_1907279965.1552404626738 Content-Type: multipart/alternative; boundary="----=_Part_2813_434680656.1552404626738" ------=_Part_2813_434680656.1552404626738 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > > > --- > > 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. > > > ------=_Part_2813_434680656.1552404626738 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Tuesday, March 12, 2019 at 5:14:30 AM UTC-7, Ju= lia Lawall wrote:


A better log message would explain why the message is not necessary. = =C2=A0I
guess that if you unfold this, you will end up at kmalloc, which provid= es
a backtrace on failure, so the message is not very useful. =C2=A0But yo= u should
trace thrugh the definition to see that this is actually what happens.= =C2=A0

I traced down the memory alloc f= unction to=C2=A0alloc_skb (network buffer alloc), all the way down to kmem_= cache_alloc, which had a=C2=A0trace_kmem_cache_alloc function to provide a = skb alloc trace.
I understand that "out of memory" mess= age 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=C2=A0netdev_err=C2=A0since generic message can be found in stac= k dump" good for this?

Wentao
=C2= =A0=C2=A0=C2=A0
=C2=A0
julia

>
> Signed-off-by: Wentao Cai <etsa...@gmail.com>
> ---
> =C2=A0drivers/staging/netlogic/xlr_net.c | 4 +---
> =C2=A01 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/sta= ging/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_de= vice *ndev)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=C2=A0=C2=A0=C2=A0=C2=A0}
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0netdev_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<= /a>.
> 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.go= ogle.com/d/optout.
>
------=_Part_2813_434680656.1552404626738-- ------=_Part_2812_1907279965.1552404626738--