From: Jason Wang <jasowang@redhat.com>
To: davem@davemloft.net, mst@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jason Wang <jasowang@redhat.com>
Subject: [net-next 5/6] net: use release_pages() in zerocopy_sg_from_iovec()
Date: Tue, 6 Aug 2013 17:45:07 +0800 [thread overview]
Message-ID: <1375782308-10565-6-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1375782308-10565-1-git-send-email-jasowang@redhat.com>
To reduce the duplicated codes.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/core/datagram.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index a8a795c..badcd93 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -48,6 +48,7 @@
#include <linux/highmem.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
+#include <linux/pagemap.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
@@ -638,10 +639,7 @@ int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
return -EMSGSIZE;
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
if (num_pages != size) {
- int j;
-
- for (j = 0; j < num_pages; j++)
- put_page(page[i + j]);
+ release_pages(&page[i], num_pages, 0);
return -EFAULT;
}
truesize = size * PAGE_SIZE;
--
1.7.1
next prev parent reply other threads:[~2013-08-06 9:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 9:45 [net-next 0/6] Reduce code duplication of zerocopy of tun and macvtap Jason Wang
2013-08-06 9:45 ` [net-next 1/6] net: move iov_pages() to net/core/iovec.c Jason Wang
2013-08-06 9:45 ` [net-next 2/6] net: move zerocopy_sg_from_iovec() to net/core/datagram.c Jason Wang
2013-08-06 9:45 ` [net-next 3/6] net: use skb_fill_page_desc() in zerocopy_sg_from_iovec() Jason Wang
2013-08-06 9:45 ` [net-next 4/6] net: remove the useless comment " Jason Wang
2013-08-06 9:45 ` Jason Wang [this message]
2013-08-06 9:45 ` [net-next 6/6] net: use skb_copy_datagram_from_iovec() " Jason Wang
2013-08-07 23:52 ` [net-next 0/6] Reduce code duplication of zerocopy of tun and macvtap David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375782308-10565-6-git-send-email-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).