From patchwork Mon Oct 28 11:58:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13853377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7956CD1359B for ; Mon, 28 Oct 2024 12:05:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E25F66B008A; Mon, 28 Oct 2024 08:05:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD6406B0098; Mon, 28 Oct 2024 08:05:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9D9B6B009D; Mon, 28 Oct 2024 08:05:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ADA696B008A for ; Mon, 28 Oct 2024 08:05:19 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 009BEA0959 for ; Mon, 28 Oct 2024 12:04:37 +0000 (UTC) X-FDA: 82722879582.03.126CD39 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf24.hostedemail.com (Postfix) with ESMTP id 2366018001D for ; Mon, 28 Oct 2024 12:05:12 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730116958; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=krmAYYUX1yhyZczAT2DZ8OPygsoGd9yRZgKs01bBgIY=; b=F2iOMlgAWAnmHBhbwYUvxvla6hOvdmIu1Gswo5SIL0n4szMY9Yqd68h0muqQlm23RIbCG0 yr2LH9aY3ewZlB/k5qKWCgjEc3ayaVt9t5Q9idQEAvLFNnnoobW3Ekkr/RhdrGEz+C1Jap Pgq5LnJU9bQ3SVI3c3PupptLfhtEhWc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730116958; a=rsa-sha256; cv=none; b=nCuwLoMN6Jh8yjy/0W23BA7FFQKHLVhTFfB/wb9cLvRJGfWLU53RijBAqGttbC97sCusys XHpdPCEw4RUWSQqtF/2WzB7F8tdhcyKsFXIiszf52D5bqvJqYEewkROI7tHTiK+vt3ihTy yoP6CYV7mQbLsTbgQ1FEmOSyqNPUXvU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4XcX992ZR6z1SDPT; Mon, 28 Oct 2024 20:03:41 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 8FDBD14010C; Mon, 28 Oct 2024 20:05:11 +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; Mon, 28 Oct 2024 20:05:11 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Linux-MM , Eric Dumazet , Simon Horman , David Ahern Subject: [PATCH RFC 02/10] net: rename skb_copy_to_page_nocache() helper Date: Mon, 28 Oct 2024 19:58:42 +0800 Message-ID: <20241028115850.3409893-3-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241028115850.3409893-1-linyunsheng@huawei.com> References: <20241028115850.3409893-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.30.45] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf200006.china.huawei.com (7.185.36.61) X-Stat-Signature: g1nosip9ygfw1a5qofurcmqb7id6684z X-Rspamd-Queue-Id: 2366018001D X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1730117112-881221 X-HE-Meta: U2FsdGVkX18Jh2g0lrWRFHP9gR2bnUWWKoLGnT9za2gMAxjpV4V+sUjYC5k3BD8FtJHJtXJQiXzJYpUWqzmN8Fe4UCL2xo1ZQ/JZE0uvywsNM8KO3iuUSiLVnn3Dt3LGEOfBhvA6gXpRyONbzr2eX8FLDDCPu9Dbb1NZO7HDG/t1ggwq37ohROChS1wQD/fQ5PigUli6rgLZ3JVN+HY+fJcnRJWG2gAgxnoIjKFsUfJTf37OgwXW2IVs1PsnOHjS4v37gFOzXSXjur+WJ+ps2eFXR3VFzVcKf/medCZyAET6SHMwFLcyvR62sjUKskN2fJUtpVgyP2RxK5Zmx1Gb3EfwcQ5pKoY9/Q0d/pX7qKM+6Gf+GAbkAWcE3bJNTSNBknqhJC1guk7KR7XFgfmg18XWXJCfQD4N1YiOlGGJTuHBkNWTZACN0dBKbDMSUNYL+2RDhZaN3KXtt0uqz++UHTRIHLGJ9QtcHi9HtovLe8ttbi6VLX9oU2e8GRZJAIpyy7t36y9FRLGqYCIEpPP+AXnDJWMlDdKKVwJ+5Fs/Dds7L+Kqfqe4pRdfrwHahNb3SKcji+5htUkC7ABkzdMFVPv0PX+fa1xD918ux0O1RujVxoVqqeiJaK7vEAj2WM5Wl6ytbVsGq0QDF7n64ATD/wIUP9C/P2XW6MzRT/iZK0LNVWPKkuuZRbA9Nhhr0bTvyMeIZqBYYmjBX7hPPMJJpn+dQ7hBQDczbUDlwZRntU0JvbzCj01lBmkDrIcILTcx93C2rAJbFS2WPOU2jmy6pBo+pgwG3lY3U9cIhN93j0j1iitioNU/EIb/QO+nV0ylX5p1BJAjhFT1u2yiBe/mPUbwGQpdZv9rvWDbZrAHhIuaf743/3BtMcrXIRfO3DWujfTYgK0JwTJtLQ72HnPvtP8r28+AWIOVv4f3Mon2QQgIJ2n9RJQ4C6PmdSf4K2u4DKbUsojEJyWF5GO2Lfz g0woxSZk L3ALrHqtsTxNRcijQ2C8lhSJByZIVA5Q+KMZk7VE+syRjwceYwubdicKmo6yue8zyxEmp35R+qZuvx0mxXLIGhSz7uuhncDQ1jr20GTywB8SBzYwxp8ztG8ZBS0KZb6UMgIhVGFd4ZnqakHyXRxlHoN8xkGvAZyBvRBl7gHE5nLZX0MoYSvmDiNqkAUhdwZAuhjepswivMIEMNFse7mk2TNKfEpYtmFv+iksn0Y6ATwZrgf+5R2y9n98pVOapvyddqTi0UfM7z4DG70PSkAnucRAGh9zj0p/pkOInNkiAx4frUMg/ZBDL3TN2mpJViZCt3vQ1Eb20h42K5y2jV2foKjgvpiPVfOrBfXa8GVX3Iqqth7V5YK+oHnYUM7oxV2bhHNgJHHHqnA4U/DwjXGRUFZsxtg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 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;