From patchwork Fri Dec 6 12:25:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13897119 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 A6066E77173 for ; Fri, 6 Dec 2024 12:32:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EE806B025C; Fri, 6 Dec 2024 07:32:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 09E9F6B025F; Fri, 6 Dec 2024 07:32:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA8B16B0260; Fri, 6 Dec 2024 07:32:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CA34C6B025C for ; Fri, 6 Dec 2024 07:32:29 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5777CB00E1 for ; Fri, 6 Dec 2024 12:32:29 +0000 (UTC) X-FDA: 82864471998.15.AA6F050 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf03.hostedemail.com (Postfix) with ESMTP id 5BB5A2001F for ; Fri, 6 Dec 2024 12:32:18 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 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=1733488336; 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=Sc6UEFUSybzUj7X6WFKpSwXS5YXdH9SqGwk565RBYY9L23OhzJ/5vUHMbBY40oiDp62bel aOkqVBmsCgCKyI9wlSfBg/iMOopQTumwaHsfyxXO0YJW+COgIBt2V1Q98HK/zgkbGmwOLo uXaZrrSvFgRWBEAZWFDvOPzNrA3NYkM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733488336; a=rsa-sha256; cv=none; b=7oSUzqkguKhzLRNn35hEx9fWm5UCpeZXqjKazfEi27MrZmXZA8i/ibzz476i+HV6n8BVGn S5ND/d6ICzdci4XVhgMOr9f4yEz94E4lyOJt7gEKix7wk+i2LQJMXXBjp9LZCDUbzyvIcz w4V6MuuPwYGQGxyc3FGIqzE4W4yTBgg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Y4Vvd0Qjyz1kvJB; Fri, 6 Dec 2024 20:30:05 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 60CC41A0188; Fri, 6 Dec 2024 20:32:24 +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; Fri, 6 Dec 2024 20:32:24 +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 v2 02/10] net: rename skb_copy_to_page_nocache() helper Date: Fri, 6 Dec 2024 20:25:25 +0800 Message-ID: <20241206122533.3589947-3-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241206122533.3589947-1-linyunsheng@huawei.com> References: <20241206122533.3589947-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-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5BB5A2001F X-Stat-Signature: yy79515ihmgtxtjth74yzwq8dwq35oww X-Rspam-User: X-HE-Tag: 1733488338-884071 X-HE-Meta: U2FsdGVkX1/LDoWuhXVgDvSKBfKsTljWrn/jt2Z87rQpr5UCdTpIN1tqgHTjAGl+39KuhwcinNqDgBfyCt9MPHI1cYOA0LSlyzE+JWtSPRH36bedI5lN3Enmz3T/Wcb7t/ojG3egHg5xqS9BpKTURVoNb+gHM4sZGG54d/zYVxaC4ykVilxgIrKtoEv3YrBrCjuMrOhaM9fBS+gVrXOE4Vgf+sPYCYK8wmQ16WC3/uWXgV/PqCJifQZ9fVANBfYzcQM7uFPPZnxNnYtOmdT869mD6FlCcmQKYmJaoW/JiIK8nZJpnFz9AMZYLH080ZyXE5l9JlBEJrjzP6wEuT4GRj6x15DyF0SA5JFz4a5kOmSBvmkpaV2h7qKAKNUk1vJI6P1+gZbz3HOJXjAMH3+/6+IivMXC6dHnFRdnN8mZiZ3yG+/L6WYUb3Q4wFQUVhD2M3e1vUgtGNxOXPk3FL0wrpZCcm0+PhlRpMegg3MXnkn5GoBKfGvVDehH+uMRMSsG51JXw65zx3v6s34ten4nN9u4zm6CRw/aOjZjbCxkC/y1bUP70oIK+Mm66GNWrxMiVyx+OA2wMvAxOfJQCc1ceB+uLG9AprfRZNBl0GWymUJLGOrif2Vd2BiJ32ScY8TfejwSvRCcynPFYLrn9TDAwHOUOFjdO2s/xXSmEAoGqY3d7zdtBdFIFxvuJpZyqf8+WiNC9lTDDm/XgSpQpCx/ucxhS6R95w4u4sGFe2mX8ZMYbXkWwtjCBQSEy+ny7kE+8UqT3GDTMcgdzpH1HIh003/cz4sH3LZl/8PoPNZxjXjaJjAJkSGqN7QSlwkrdVPmzL8bU2wm5UPauZqJhGU3vHjNYIpLGKswW86Qqjy4zd0EGCG9G60t14LiMW9dB0wnGJzfoGSxB+NXUg9F2d+odt8cMubXyoONLXipnyDjeoY1cpXlSP84wwsG3KLzipjA1Uul4yNFOCMgql53Lzo f0uk9T0Z 5qxD0HfICLBDmDBNe2gEfAcPoquEw6ys488eTm/wCBJPDdEKUeRUQ3QcgyunT4tT/tgpSQuvcZFdAnMrR964B6LqrxGgE0I2lU5fM+dIZMw5IvSrxzRmJkDrhZoFkkiX3CXcp9bxDB3p6M6oSo+r5ZmoXMsd4uK2YaxRHzO8+TR7K2GVKUig74eYla/bina21QhmC3sdvKTbcwJKVJkJV8a5O9E6MZ4F0hJXg8RifGuhkGztI82C1mQznsrap5XRtwp3TMDlFlwyav856xclJPUMfyLa661eBXLxx+cGGO0pDra0T5NhQsG3yi7TcM+ntaxkiycptVILMvA0r388V+3x4X35fZEHLY0ny8POTDqd50ijAosTZpZKIoASnPV0mn9+vMqNAfNMsNV1dI4b5xHGqrPDgYl6Zj+PKGgnmFPZOIU4= 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;