[NET]: Uninline kfree_skb and allow NULL argument
o Uninline kfree_skb, which saves some 15k of object code on my notebook. o Allow kfree_skb to be called with a NULL argument. Subsequent patches can remove conditional from drivers and further reduce source and object size. Signed-off-by: Jrn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
2e1f47c74c
commit
231d06ae82
@@ -355,6 +355,24 @@ void __kfree_skb(struct sk_buff *skb)
|
||||
kfree_skbmem(skb);
|
||||
}
|
||||
|
||||
/**
|
||||
* kfree_skb - free an sk_buff
|
||||
* @skb: buffer to free
|
||||
*
|
||||
* Drop a reference to the buffer and free it if the usage count has
|
||||
* hit zero.
|
||||
*/
|
||||
void kfree_skb(struct sk_buff *skb)
|
||||
{
|
||||
if (unlikely(!skb))
|
||||
return;
|
||||
if (likely(atomic_read(&skb->users) == 1))
|
||||
smp_rmb();
|
||||
else if (likely(!atomic_dec_and_test(&skb->users)))
|
||||
return;
|
||||
__kfree_skb(skb);
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_clone - duplicate an sk_buff
|
||||
* @skb: buffer to clone
|
||||
@@ -1799,6 +1817,7 @@ void __init skb_init(void)
|
||||
|
||||
EXPORT_SYMBOL(___pskb_trim);
|
||||
EXPORT_SYMBOL(__kfree_skb);
|
||||
EXPORT_SYMBOL(kfree_skb);
|
||||
EXPORT_SYMBOL(__pskb_pull_tail);
|
||||
EXPORT_SYMBOL(__alloc_skb);
|
||||
EXPORT_SYMBOL(pskb_copy);
|
||||
|
Reference in New Issue
Block a user