aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorMike Waychison <mikew@google.com>2012-01-04 07:52:32 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-05 13:20:40 -0500
commit3464645a10f80ce39bc90c5494a3e92387947818 (patch)
treedc47cf6f3965f09d65fc9bd5e628cebc9d6b3eec /drivers/net/virtio_net.c
parentea81875ae07aeaca285afd2771425f771294c93c (diff)
virtio_net: Pass gfp flags when allocating rx buffers.
Currently, the refill path for RX buffers will always allocate the buffers as GFP_ATOMIC, even if we are in process context. This will fail to apply memory pressure as the worker thread will not contribute to the freeing of memory. Fix this by changing add_recvbuf_small to use the gfp variant allocator, __netdev_alloc_skb_ip_align(). Signed-off-by: Mike Waychison <mikew@google.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2055386eda58..76fe14efb2b5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -156,6 +156,7 @@ static void set_skb_frag(struct sk_buff *skb, struct page *page,
156 *len -= size; 156 *len -= size;
157} 157}
158 158
159/* Called from bottom half context */
159static struct sk_buff *page_to_skb(struct virtnet_info *vi, 160static struct sk_buff *page_to_skb(struct virtnet_info *vi,
160 struct page *page, unsigned int len) 161 struct page *page, unsigned int len)
161{ 162{
@@ -358,7 +359,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp)
358 struct skb_vnet_hdr *hdr; 359 struct skb_vnet_hdr *hdr;
359 int err; 360 int err;
360 361
361 skb = netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN); 362 skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp);
362 if (unlikely(!skb)) 363 if (unlikely(!skb))
363 return -ENOMEM; 364 return -ENOMEM;
364 365