@@ -2183,15 +2183,12 @@ 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,
- struct sk_buff *skb,
- struct page *page,
- int off, int copy)
+static inline int skb_copy_to_va_nocache(struct sock *sk, struct iov_iter *from,
+ struct sk_buff *skb, 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;
@@ -1215,10 +1215,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_va_nocache(sk, &msg->msg_iter, skb,
+ page_address(pfrag->page) +
+ pfrag->offset, copy);
if (err)
goto do_error;
@@ -855,10 +855,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_va_nocache(sk, &msg->msg_iter, skb,
+ page_address(pfrag->page) +
+ pfrag->offset, copy);
if (err)
goto out_error;
Rename skb_copy_to_page_nocache() to skb_copy_to_va_nocache() to avoid calling virt_to_page() as we are about to pass virtual address directly. CC: Alexander Duyck <alexander.duyck@gmail.com> 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, 9 insertions(+), 14 deletions(-)