summaryrefslogtreecommitdiffstats
path: root/net/core/skbuff.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@redhat.com>2015-05-06 21:12:03 -0700
committerDavid S. Miller <davem@davemloft.net>2015-05-12 10:39:26 -0400
commit181edb2bfa22b50817684135ab6430ed2808abf0 (patch)
tree3715f6eb8768c5a8ef58dff4524ccfe3d87344d6 /net/core/skbuff.c
parentb63ae8ca096dfdbfeef6a209c30a93a966518853 (diff)
downloadlinux-181edb2bfa22b50817684135ab6430ed2808abf0.tar.bz2
net: Add skb_free_frag to replace use of put_page in freeing skb->head
This change adds a function called skb_free_frag which is meant to compliment the function netdev_alloc_frag. The general idea is to enable a more lightweight version of page freeing since we don't actually need all the overhead of a put_page, and we don't quite fit the model of __free_pages. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r--net/core/skbuff.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index dcc0e07abf47..d67e612bf0ef 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -436,7 +436,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
skb = __build_skb(data, len);
if (unlikely(!skb)) {
- put_page(virt_to_head_page(data));
+ skb_free_frag(data);
return NULL;
}
@@ -490,7 +490,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len,
skb = __build_skb(data, len);
if (unlikely(!skb)) {
- put_page(virt_to_head_page(data));
+ skb_free_frag(data);
return NULL;
}
@@ -549,10 +549,12 @@ static void skb_clone_fraglist(struct sk_buff *skb)
static void skb_free_head(struct sk_buff *skb)
{
+ unsigned char *head = skb->head;
+
if (skb->head_frag)
- put_page(virt_to_head_page(skb->head));
+ skb_free_frag(head);
else
- kfree(skb->head);
+ kfree(head);
}
static void skb_release_data(struct sk_buff *skb)