diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-19 19:14:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-21 02:53:00 -0400 |
commit | 4b727361f0bc7ee7378298941066d8aa15023ffb (patch) | |
tree | 9cee8374f965ade07d0ef9479e93af493ccaa32e /drivers/net/virtio_net.c | |
parent | e1ac50f64691de9a095ac5d73cb8ac73d3d17dba (diff) |
virtio_net: fix truesize underestimation
We must account in skb->truesize, the size of the fragments, not the
used part of them.
Doing this work is important to avoid unexpected OOM situations.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: virtualization@lists.linux-foundation.org
CC: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index abbf34fcf4cd..765ab9ac9d17 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -150,6 +150,7 @@ static void set_skb_frag(struct sk_buff *skb, struct page *page, | |||
150 | 150 | ||
151 | skb->data_len += size; | 151 | skb->data_len += size; |
152 | skb->len += size; | 152 | skb->len += size; |
153 | skb->truesize += PAGE_SIZE; | ||
153 | skb_shinfo(skb)->nr_frags++; | 154 | skb_shinfo(skb)->nr_frags++; |
154 | *len -= size; | 155 | *len -= size; |
155 | } | 156 | } |
@@ -287,7 +288,6 @@ static void receive_buf(struct net_device *dev, void *buf, unsigned int len) | |||
287 | } | 288 | } |
288 | 289 | ||
289 | hdr = skb_vnet_hdr(skb); | 290 | hdr = skb_vnet_hdr(skb); |
290 | skb->truesize += skb->data_len; | ||
291 | 291 | ||
292 | u64_stats_update_begin(&stats->syncp); | 292 | u64_stats_update_begin(&stats->syncp); |
293 | stats->rx_bytes += skb->len; | 293 | stats->rx_bytes += skb->len; |