[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150908.140110.899240065088272758.davem@davemloft.net>
Date: Tue, 08 Sep 2015 14:01:10 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: brouer@...hat.com
Cc: netdev@...r.kernel.org, akpm@...ux-foundation.org,
linux-mm@...ck.org, aravinda@...ux.vnet.ibm.com, cl@...ux.com,
paulmck@...ux.vnet.ibm.com, iamjoonsoo.kim@....com
Subject: Re: [RFC PATCH 1/3] net: introduce kfree_skb_bulk() user of
kmem_cache_free_bulk()
From: Jesper Dangaard Brouer <brouer@...hat.com>
Date: Fri, 04 Sep 2015 19:00:53 +0200
> +/**
> + * kfree_skb_bulk - bulk free SKBs when refcnt allows to
> + * @skbs: array of SKBs to free
> + * @size: number of SKBs in array
> + *
> + * If SKB refcnt allows for free, then release any auxiliary data
> + * and then bulk free SKBs to the SLAB allocator.
> + *
> + * Note that interrupts must be enabled when calling this function.
> + */
> +void kfree_skb_bulk(struct sk_buff **skbs, unsigned int size)
> +{
> + int i;
> + size_t cnt = 0;
> +
> + for (i = 0; i < size; i++) {
> + struct sk_buff *skb = skbs[i];
> +
> + if (!skb_dec_and_test(skb))
> + continue; /* skip skb, not ready to free */
> +
> + /* Construct an array of SKBs, ready to be free'ed and
> + * cleanup all auxiliary, before bulk free to SLAB.
> + * For now, only handle non-cloned SKBs, related to
> + * SLAB skbuff_head_cache
> + */
> + if (skb->fclone == SKB_FCLONE_UNAVAILABLE) {
> + skb_release_all(skb);
> + skbs[cnt++] = skb;
> + } else {
> + /* SKB was a clone, don't handle this case */
> + __kfree_skb(skb);
> + }
> + }
> + if (likely(cnt)) {
> + kmem_cache_free_bulk(skbuff_head_cache, cnt, (void **) skbs);
> + }
> +}
You're going to have to do a trace_kfree_skb() or trace_consume_skb() for
these things.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists