Search Linux Wireless

Re: [PATCH 05/13] rt2x00: Add unlikely to skb allocation failure check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag 04 November 2010 schrieb Christian Lamparter:
> On Thu, Nov 4, 2010 at 7:38 PM, Ivo van Doorn <ivdoorn@xxxxxxxxx> wrote:
> > From: Helmut Schaa <helmut.schaa@xxxxxxxxxxxxxx>
> >
> > The skb allocation should really only fail under high memory pressure
> > or other uncommon situations. Hence, mark the allocation failure check
> > as unlikely.
> >
> > Signed-off-by: Helmut Schaa <helmut.schaa@xxxxxxxxxxxxxx>
> > Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
> > ---
> >  drivers/net/wireless/rt2x00/rt2x00dev.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
> > index 5ba79b9..a5c7a4f 100644
> > --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
> > +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
> > @@ -491,7 +491,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry)
> >         * received frame and reuse the existing buffer.
> >         */
> >        skb = rt2x00queue_alloc_rxskb(entry);
> > -       if (!skb)
> > +       if (unlikely(!skb))
> >                goto submit_entry;
> >
> >        /*
> > --
> err, wait a sec, I've been looking for this mail for some time, but:
> 
> http://mail.linux.ie/pipermail/ilug/2004-December/075654.html
> 
> "Note tests for NULL (!something) don't need an unlikely as gcc does
>  that by default itself."
> 
> But there's more, according to http://gcc.gnu.org/news/profiledriven.html:
> (static program profile) gcc expect pointers to be non-null
> 
> (therefore all !skb tests should be unlikely branches by default, or?)

Interesting, didn't know that. I've just given it a try and the MIPS assembly
indeed stays the same with and without the unlikely. Nevertheless, I've found
quite a number of unlikely(!x) checks throughout the net stack ...

But still, this seems unnecessary. John, please drop this patch.

Thanks Christian,
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux