On Sun, 13 Mar 2016 16:06:17 +0200 Rana Shahout <rana.sha...@gmail.com> wrote:
> On Fri, Mar 4, 2016 at 3:01 PM, Jesper Dangaard Brouer > <bro...@redhat.com> wrote: > > > /* build_skb() is wrapper over __build_skb(), that specifically > > * takes care of skb->head and skb->pfmemalloc > > * This means that if @frag_size is not zero, then @data must be backed > > @@ -490,8 +500,8 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct > > *napi, unsigned int len, > > > > len += NET_SKB_PAD + NET_IP_ALIGN; > > > > - if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || > > - (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { > > + if (unlikely((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || > > + (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA)))) { > > Why unlikely? I know it is better for the common case where most > likely linear SKBs are << SKB_WITH_OVERHEAD(PAGE_SIZE)), but what > about the case of Hardware LRO, where linear SKB is likely to be >> > SKB_WITH_OVERHEAD(PAGE_SIZE)). You said it yourself, this is better for the common case. With unlikely() I'm asking the compiler to layout the code for the common case. This helps the CPU instruction cache prefetcher. -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat Author of http://www.iptv-analyzer.org LinkedIn: http://www.linkedin.com/in/brouer