On Mon, 02 May 2016 07:34:28 -0700
Eric Dumazet <eric.duma...@gmail.com> wrote:

> On Mon, 2016-05-02 at 09:49 +0200, Jesper Dangaard Brouer wrote:
> 
> > What about using bulk free of SKBs here?
> > 
> > There is a very high probability that we are hitting SLUB slowpath,
> > which involves an expensive locked cmpxchg_double per packet.  Instead
> > we can amortize this cost via kmem_cache_free_bulk().
> > 
> > Maybe extend kfree_skb_list() to hide the slab/kmem_cache call?  
> 
> Sounds tricky, because of skb destructors. skb are complex objects.
> 
> For each skb, need to free the frags, skb->head, and skb.

It is not that complicated, inside kfree_skb_list(), we just call
skb_release_all(skb) on each SKB first, and then bulk free the SKB's
themselves in the end.  Example see, _kfree_skb_defer().

The question is where to store the SKB array needed by kmem_cache_free_bulk.

The easy option is just to use the stack of kfree_skb_list(), but we
have to be careful about the stack size, it might not be so good
because skb_release_all() can be deep and via skb_release_data() invoke
kfree_skb_list() a second time.

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

Reply via email to