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: 13875059 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 E8EB1D637A7 for ; Thu, 14 Nov 2024 12:22:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F3466B0089; Thu, 14 Nov 2024 07:22:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 77C8C6B008A; Thu, 14 Nov 2024 07:22:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F5CB6B008C; Thu, 14 Nov 2024 07:22:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 416D26B0089 for ; Thu, 14 Nov 2024 07:22:49 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 04DC3810F1 for ; Thu, 14 Nov 2024 12:22:48 +0000 (UTC) X-FDA: 82784613156.22.B7EF5D2 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP id C4BBE1C000E for ; Thu, 14 Nov 2024 12:21:22 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731586836; a=rsa-sha256; cv=none; b=kL3zKEb7KTA3zmmejlcQhFsGvcGKw9MFquVs557OQiV9I3Iq+cD0MvIVkWANFBZz724Eic PSObz2w0+tw4teoaxQrNtT8GIhAZqWsqBCjX6+b1GeL0ucyK/49L/kEx8BIVEHpDNRoOo5 k4JMZJAw6EyF8a7C6QvzIsbjAVKbHCY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731586836; 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=B8BESktr9IjMF4qyErGXRqxqIzluNuuWawkiuUhmtRQ=; b=IKQ6keOkFCXmMYlUKLZCFV+d+qtaLwAN1yalCjId3DZdM7gWQhVwN2X81un3WGuHEapk96 U71YMnzRQyPX12K7toXyqHKyJ387M8N2Myzj/KYCDs6CiNjhCBioHkvkZVcoCvCjsoVco8 2WN/Ivk0yWRJ+D+knfJH8BS6ETfkhyA= 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> MIME-Version: 1.0 X-Originating-IP: [10.90.30.45] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Queue-Id: C4BBE1C000E X-Stat-Signature: zn75p9j9wnk7hzg589x7ye3qsj4znmaj X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731586882-397790 X-HE-Meta: U2FsdGVkX1/UVUD1DyDC28DRQbNT02PWOmCxtAp22W8kVxsS03N3ppYSMraOfy036NudPygsbS8wsJoojsJLcYDq4YwFp/Zn2+ZbwrVXKwHD9tK1tA7zSSVw69pgLjLn+er4YMZX14GMwop0JrP/bliNBvSFa3Y3p3qPfWfVBQITLxxU2DqfCjOTtHl9hmG/9Ml/AC2gViSsAIM2AU8OTKqkKs7BxL1zucEF9ndUfgZPP3in2MxJ6uSmD5Uqu+4bVf7SFU/mFCbV6AdcIG6K/H6WHIbUNggjHA2rez4c2MzfXNZ/KxAqBa7tbwAzo9yS/vHgabwArB52bGGBMLLCiHaweQNNVdIotUPxACugA2c9cbRUIXP5uJTxlldpXs3y2AgIolST3O71Bfc56+en1iOm/P7zTkWivaZm17Eh/lRllhBB4zCGObli0NPL82INZbeXVlhIvIGUKkXhIQjFQC8oafl+F7ddwJFTMzE9K1UCPO303PyZsQu33rn/9p2mDWGI2u9zZBeBJ+qG6uIMXi6CpLAnlg0it35GIwnU7RRsqIUwPibpqkMOxiEEOwD25Z6CshE8B1t1FvONmNkr6W3Po4QxGtLTm0kRefAjLoSp0SSgua2UcY0pMpnHeT5uZVN+VMX4dlZq6mAXlz+Y0H+JvA9XFzg32tt7xm6K4YB+LyzIY49vkcmJpTJp76ZuMr7oPpEtnX2PX4bJhlnUNjwV37+lo04hTrBjqVE9eohuwRS7GBufHxR4R+O++wROgaM4qrzTtqQePxqseNa+xOYLO0mqS6gY0rtl2xgm8MtYMhjBbS2VKTsPEq9DsX1igXRD0171jFfdO2/tpCZqI4cmndTWibekIqX94V7plOJJMetvGBwFlJvu1RC9I0r7R7pnME6o5Elgr2V7X5hH28hnn1MPUbt2ZWhOJBjVLxuBxblkZJBDaiC8UyDIUxRY927m+ZudHJdN4IRQVv/ iGVT+fQY r7++SmfrzVHOUYyvbRuews/DdzPVPBHmFmr7ArFqgN64f85lHpDfQ+W0/1yyj0yP8VB7HRMn+S7j9awESTfssMWJzlmE+oEl+PN2R1ng2M2IV0zhEE+De7jMzd623lbDs4iiib20yR4K9su5Fj0BXYFev+oix9cVU2eK8HikgzkmAGDMsVtKVXa9C2YwyZq53kgTjbRVT7U98/tipqQCSmUodDl/bIRRwCcOAJ/p7qhE+fWCXHisE5uE4RPNqRZU7Xh0dXPxsnmbJTYe14Gk017PFPJW4P5s6IUsbfTp6oD89OlBDG1jfZoaRiUUy+cjxzv49HXIwbfLNgVif+Lu7ggXAcfGQ91Ct7jjRFHQeqFwZxAb3QXQzgILN5b0D3gwNNcxBlSMePYDOtDrBbviH/gF3Z1hCwh2rbNOquMUJ4g8t6mA= 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 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;