use alloc_page instead of alloc_pages (0)
Subsystems (4)
PATCH 1/1 use alloc_page instead of alloc_pages (0)
The attached patch is pretty obvious and should apply on top of net-next-2.6. I resisted the temptation to define alloc_page_node in include/linux/gfp.h to get rid of the call to alloc_pages_node in net/core/skbuff.c for symmetry but I would be happy to submit another patch with this if others want it.
Mathieu
Signature · 2 lines
Mathieu Lacage <[email protected]> Tel: +33 4 9238 5056
commit 24559b5892690655f1223ca8600eeaad02c5327d
Author: Mathieu Lacage <[email protected]> Date: Mon May 10 10:31:00 2010 +0200
use alloc_page instead of alloc_pages (0)
net/core/pktgen.c +2 -2
@@ -2712,7 +2712,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, i =0 ;while (datalen >0 ) { -struct page *page =alloc_pages (GFP_KERNEL | __GFP_ZERO,0 ); +struct page *page =alloc_page (GFP_KERNEL | __GFP_ZERO);skb_shinfo (skb)->frags[i].page = page;skb_shinfo (skb)->frags[i].page_offset =0 ; skb_shinfo(skb)->frags[i].size =
@@ -3062,7 +3062,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, i =0 ;while (datalen >0 ) { -struct page *page =alloc_pages (GFP_KERNEL ,0 ); +struct page *page =alloc_page (GFP_KERNEL );skb_shinfo (skb)->frags[i].page = page;skb_shinfo (skb)->frags[i].page_offset =0 ; skb_shinfo(skb)->frags[i].size =
net/core/skbuff.c +2 -2
@@ -1387,7 +1387,7 @@ static inline struct page *linear_to_page(struct page *page, unsigned int *len,if (!p) { new_page: - p = sk->sk_sndmsg_page =alloc_pages (sk->sk_allocation,0 ); + p = sk->sk_sndmsg_page =alloc_page (sk->sk_allocation);if (!p)return NULL ;
@@ -2428,7 +2428,7 @@ int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,return -EFAULT ;/* allocate a new page for next frag */ - page =alloc_pages (sk->sk_allocation,0 ); + page =alloc_page (sk->sk_allocation);/* If alloc_page fails just return failure and caller will * free previous allocated pages by doing kfree_skb()
net/core/sock.c +1 -1
@@ -1457,7 +1457,7 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,struct page *page;skb_frag_t *frag; - page =alloc_pages (sk->sk_allocation,0 ); + page =alloc_page (sk->sk_allocation);if (!page) { err = -ENOBUFS ;skb_shinfo (skb)->nr_frags = i;
net/ipv4/ip_output.c +1 -1
@@ -1031,7 +1031,7 @@ alloc_new_skb: }else if (i <MAX_SKB_FRAGS ) {if (copy >PAGE_SIZE ) copy =PAGE_SIZE ; - page =alloc_pages (sk->sk_allocation,0 ); + page =alloc_page (sk->sk_allocation);if (page ==NULL ) { err = -ENOMEM ; goto error;
net/ipv6/ip6_output.c +1 -1
@@ -1392,7 +1392,7 @@ alloc_new_skb: }else if (i <MAX_SKB_FRAGS ) {if (copy >PAGE_SIZE ) copy =PAGE_SIZE ; - page =alloc_pages (sk->sk_allocation,0 ); + page =alloc_page (sk->sk_allocation);if (page ==NULL ) { err = -ENOMEM ; goto error;