From patchwork Thu Nov 14 12:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13875080 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4393E1F8F13; Thu, 14 Nov 2024 12:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731586972; cv=none; b=N2fsBLRFoVuLsbum7djyYELdKIq09AV3xuofZXgUpN3L6bkmqEc4i4j4K24goCZHegPC8BdeLevaPfO6ZYnlGJ5TUmMC7VAMyTQYc/XC7EsfySUKMGycKeN+wDH0fM5etS46s/FqoVh7ODRfYxebRGchxDc9OEMS+lTFHZbDaGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731586972; c=relaxed/simple; bh=xejgqni1EIbh5amZT9zq8y15En+rGnH1JwJI8AwQOiQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IX/YLoT1GY2yy7lQqekBnOpsPZvDDVEGguas0VBTrXWuul0EsVBq5nRP1Xh4jHkTYi97zait3zZE6KIDtJpwZB1CXNcriZREojpeURdz5A3HZ3wWCzQjnpHOkQ32fX+bnyBBztFMIw0784bNjuj622NlHvXdA/wWZ53yJi0pS7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Xpzl158h6z10V9f; Thu, 14 Nov 2024 20:20:45 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 264411400DC; Thu, 14 Nov 2024 20:22:41 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 14 Nov 2024 20:22:40 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Linux-MM , Alexander Duyck , Eric Dumazet , Simon Horman , David Ahern Subject: [PATCH net-next v1 02/10] net: rename skb_copy_to_page_nocache() helper Date: Thu, 14 Nov 2024 20:15:57 +0800 Message-ID: <20241114121606.3434517-3-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241114121606.3434517-1-linyunsheng@huawei.com> References: <20241114121606.3434517-1-linyunsheng@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf200006.china.huawei.com (7.185.36.61) X-Patchwork-Delegate: kuba@kernel.org 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 CC: Andrew Morton CC: Linux-MM Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck --- 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 0d704bda6c41..0fbf1e222cda 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;