summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch
new file mode 100644
index 00000000..b00f0b92
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0017-macvtap-zerocopy-fix-truesize-underestimation.patch
@@ -0,0 +1,46 @@
1From e2261c8945dd5af5a0627ac72f7a39f676f3b657 Mon Sep 17 00:00:00 2001
2From: Jason Wang <jasowang@redhat.com>
3Date: Wed, 2 May 2012 11:41:44 +0800
4Subject: [PATCH 017/109] macvtap: zerocopy: fix truesize underestimation
5
6commit 4ef67ebedffa44ed9939b34708ac2fee06d2f65f upstream.
7
8As the skb fragment were pinned/built from user pages, we should
9account the page instead of length for truesize.
10
11Signed-off-by: Jason Wang <jasowang@redhat.com>
12Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 drivers/net/macvtap.c | 6 ++++--
16 1 files changed, 4 insertions(+), 2 deletions(-)
17
18diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
19index 4505008..c7a84eb 100644
20--- a/drivers/net/macvtap.c
21+++ b/drivers/net/macvtap.c
22@@ -518,6 +518,7 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
23 struct page *page[MAX_SKB_FRAGS];
24 int num_pages;
25 unsigned long base;
26+ unsigned long truesize;
27
28 len = from->iov_len - offset;
29 if (!len) {
30@@ -532,10 +533,11 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
31 (num_pages > MAX_SKB_FRAGS - skb_shinfo(skb)->nr_frags))
32 /* put_page is in skb free */
33 return -EFAULT;
34+ truesize = size * PAGE_SIZE;
35 skb->data_len += len;
36 skb->len += len;
37- skb->truesize += len;
38- atomic_add(len, &skb->sk->sk_wmem_alloc);
39+ skb->truesize += truesize;
40+ atomic_add(truesize, &skb->sk->sk_wmem_alloc);
41 while (len) {
42 int off = base & ~PAGE_MASK;
43 int size = min_t(int, len, PAGE_SIZE - off);
44--
451.7.7.6
46