This is a note to let you know that I've just added the patch titled

    macvtap: zerocopy: fix truesize underestimation

to the 3.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     macvtap-zerocopy-fix-truesize-underestimation.patch
and it can be found in the queue-3.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 4ef67ebedffa44ed9939b34708ac2fee06d2f65f Mon Sep 17 00:00:00 2001
From: Jason Wang <[email protected]>
Date: Wed, 2 May 2012 11:41:44 +0800
Subject: macvtap: zerocopy: fix truesize underestimation

From: Jason Wang <[email protected]>

commit 4ef67ebedffa44ed9939b34708ac2fee06d2f65f upstream.

As the skb fragment were pinned/built from user pages, we should
account the page instead of length for truesize.

Signed-off-by: Jason Wang <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/net/macvtap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -520,6 +520,7 @@ static int zerocopy_sg_from_iovec(struct
                struct page *page[MAX_SKB_FRAGS];
                int num_pages;
                unsigned long base;
+               unsigned long truesize;
 
                len = from->iov_len - offset;
                if (!len) {
@@ -535,10 +536,11 @@ static int zerocopy_sg_from_iovec(struct
                if (num_pages != size)
                        /* put_page is in skb free */
                        return -EFAULT;
+               truesize = size * PAGE_SIZE;
                skb->data_len += len;
                skb->len += len;
-               skb->truesize += len;
-               atomic_add(len, &skb->sk->sk_wmem_alloc);
+               skb->truesize += truesize;
+               atomic_add(truesize, &skb->sk->sk_wmem_alloc);
                while (len) {
                        int off = base & ~PAGE_MASK;
                        int size = min_t(int, len, PAGE_SIZE - off);


Patches currently in stable-queue which might be from [email protected] are

queue-3.4/macvtap-zerocopy-put-page-when-fail-to-get-all-requested-user-pages.patch
queue-3.4/macvtap-zerocopy-fix-truesize-underestimation.patch
queue-3.4/macvtap-zerocopy-fix-offset-calculation-when-building-skb.patch
queue-3.4/macvtap-zerocopy-set-skbtx_dev_zerocopy-only-when-skb-is-built-successfully.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to