From: Yunsheng Lin <linyunsheng@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Yunsheng Lin <linyunsheng@huawei.com>,
Alexander Duyck <alexander.duyck@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>, Eric Dumazet <edumazet@google.com>,
Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>
Subject: [PATCH RFC 02/10] net: rename skb_copy_to_page_nocache() helper
Date: Mon, 28 Oct 2024 19:58:42 +0800 [thread overview]
Message-ID: <20241028115850.3409893-3-linyunsheng@huawei.com> (raw)
In-Reply-To: <20241028115850.3409893-1-linyunsheng@huawei.com>
Rename skb_copy_to_page_nocache() to skb_copy_to_frag_nocache()
to avoid calling virt_to_page() as we are about to pass virtual
address directly.
CC: Alexander Duyck <alexander.duyck@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux-MM <linux-mm@kvack.org>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
include/net/sock.h | 9 ++++-----
net/ipv4/tcp.c | 7 +++----
net/kcm/kcmsock.c | 7 +++----
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 7464e9f9f47c..cf037c870e3b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2203,15 +2203,14 @@ static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb,
return err;
}
-static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *from,
+static inline int skb_copy_to_frag_nocache(struct sock *sk,
+ struct iov_iter *from,
struct sk_buff *skb,
- struct page *page,
- int off, int copy)
+ char *va, int copy)
{
int err;
- err = skb_do_copy_data_nocache(sk, skb, from, page_address(page) + off,
- copy, skb->len);
+ err = skb_do_copy_data_nocache(sk, skb, from, va, copy, skb->len);
if (err)
return err;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 82cc4a5633ce..d5d2fca8a688 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1219,10 +1219,9 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
if (!copy)
goto wait_for_space;
- err = skb_copy_to_page_nocache(sk, &msg->msg_iter, skb,
- pfrag->page,
- pfrag->offset,
- copy);
+ err = skb_copy_to_frag_nocache(sk, &msg->msg_iter, skb,
+ page_address(pfrag->page) +
+ pfrag->offset, copy);
if (err)
goto do_error;
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 24aec295a51c..94719d4af5fa 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -856,10 +856,9 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
if (!sk_wmem_schedule(sk, copy))
goto wait_for_memory;
- err = skb_copy_to_page_nocache(sk, &msg->msg_iter, skb,
- pfrag->page,
- pfrag->offset,
- copy);
+ err = skb_copy_to_frag_nocache(sk, &msg->msg_iter, skb,
+ page_address(pfrag->page) +
+ pfrag->offset, copy);
if (err)
goto out_error;
--
2.33.0
next prev parent reply other threads:[~2024-10-28 12:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241028115850.3409893-1-linyunsheng@huawei.com>
2024-10-28 11:58 ` [PATCH RFC 01/10] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-10-28 11:58 ` Yunsheng Lin [this message]
2024-10-28 17:49 ` [PATCH RFC 02/10] net: rename skb_copy_to_page_nocache() helper Alexander Duyck
2024-10-28 11:58 ` [PATCH RFC 03/10] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 04/10] mm: page_frag: introduce page_frag_alloc_abort() related API Yunsheng Lin
2024-10-28 17:53 ` Alexander Duyck
2024-10-29 9:39 ` Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 05/10] mm: page_frag: introduce refill prepare & commit API Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 06/10] mm: page_frag: introduce alloc_refill " Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 07/10] mm: page_frag: introduce probe related API Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 08/10] mm: page_frag: add testing for the newly added API Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 09/10] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-10-28 11:58 ` [PATCH RFC 10/10] mm: page_frag: add an entry in MAINTAINERS for page_frag Yunsheng Lin
2024-10-28 23:27 ` Jakub Kicinski
2024-10-29 9:40 ` Yunsheng Lin
2024-10-29 14:33 ` Jakub Kicinski
2024-10-30 11:32 ` Yunsheng Lin
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=20241028115850.3409893-3-linyunsheng@huawei.com \
--to=linyunsheng@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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