Re: [RFC PATCH v1 1/2] virtio_net: Pass gfp flags when allocating rx buffers.
From: Rusty Russell ru...@rustcorp.com.au Date: Thu, 05 Jan 2012 10:40:02 +1030 On Wed, 04 Jan 2012 14:52:32 -0800, Mike Waychison mi...@google.com wrote: 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 mi...@google.com OK, this is a no-brainer. Thanks! Dave, can you pick this up? Acked-by: Rusty Russell ru...@rustcorp.com.au Applied. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[RFC PATCH v1 1/2] 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 mi...@google.com --- drivers/net/virtio_net.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2055386..76fe14e 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, *len -= size; } +/* Called from bottom half context */ static struct sk_buff *page_to_skb(struct virtnet_info *vi, struct page *page, unsigned int len) { @@ -358,7 +359,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, gfp_t gfp) struct skb_vnet_hdr *hdr; int err; - skb = netdev_alloc_skb_ip_align(vi-dev, MAX_PACKET_LEN); + skb = __netdev_alloc_skb_ip_align(vi-dev, MAX_PACKET_LEN, gfp); if (unlikely(!skb)) return -ENOMEM; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH v1 1/2] virtio_net: Pass gfp flags when allocating rx buffers.
On Wed, 04 Jan 2012 14:52:32 -0800, Mike Waychison mi...@google.com wrote: 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 mi...@google.com OK, this is a no-brainer. Thanks! Dave, can you pick this up? Acked-by: Rusty Russell ru...@rustcorp.com.au Cheers, Rusty. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization