Message ID | 20230329141354.516864-13-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 CA45FC74A5B for <linux-mm@archiver.kernel.org>; Wed, 29 Mar 2023 14:14:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60DB76B0087; Wed, 29 Mar 2023 10:14:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BDFE6B0088; Wed, 29 Mar 2023 10:14:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43A046B0089; Wed, 29 Mar 2023 10:14:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3053B6B0087 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 10:14:41 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 082FF160D1D for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:14:41 +0000 (UTC) X-FDA: 80622131562.15.CA861FF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 3CDD6C002A for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:14:38 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EkhqoFr4; spf=pass (imf28.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680099278; a=rsa-sha256; cv=none; b=V17NZ4PhSeQtNyhvY5uRvSpNh6PfAM8XfRrjYiXxz6dOvjMOs3ycFEN17yP1OzgGajsd+h FgoDY6sEIhUsJ4wAagsPFgbOLVYy/z/O5QCqe+Ur2F/NkQ1wagvZ6EeW+qVZX0bdCeJ1nL G3AGwY3lSyiahUDIM+/BVTEFLyNi2Ig= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EkhqoFr4; spf=pass (imf28.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680099278; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=7aq40AynbJAtoGaCRQ/pLMwBCpiSR+pOUpiksG0F/QBgOHGqUsl7O0rY/IvNJG/JoH4o+y E1VXtHWD8TkuPHJpJ1s0Q/WqQVo0s1Z5LBPeZA32FeMGKTQ5Fd2q1gaU+rCqv6InwSWjHO es92hDJo423ZVLRks7rjutdc2CQUL4k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=EkhqoFr4Q/AKgIncNUIt61FcbK31PU8oe5MPjt0AepOz4pL6ofZ4tAN4CwN6xFzFMDCgme 12qMSpKbZtxn0G6As8R55763879sEV9mYD96Kuj0AuYb07iw+5H8J2bf4Ll2kumdi3N8mJ BX85i9jU6Iu0IcHyXiJBQFOYLQwYfDI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-FOdpR13LNSGAWxRHNrnIWQ-1; Wed, 29 Mar 2023 10:14:34 -0400 X-MC-Unique: FOdpR13LNSGAWxRHNrnIWQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14F9B185A78F; Wed, 29 Mar 2023 14:14:33 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB6FCC15BA0; Wed, 29 Mar 2023 14:14:30 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Matthew Wilcox <willy@infradead.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: David Howells <dhowells@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org>, Jens Axboe <axboe@kernel.dk>, Jeff Layton <jlayton@kernel.org>, Christian Brauner <brauner@kernel.org>, Chuck Lever III <chuck.lever@oracle.com>, Linus Torvalds <torvalds@linux-foundation.org>, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Steffen Klassert <steffen.klassert@secunet.com>, Herbert Xu <herbert@gondor.apana.org.au> Subject: [RFC PATCH v2 12/48] espintcp: Inline do_tcp_sendpages() Date: Wed, 29 Mar 2023 15:13:18 +0100 Message-Id: <20230329141354.516864-13-dhowells@redhat.com> In-Reply-To: <20230329141354.516864-1-dhowells@redhat.com> References: <20230329141354.516864-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Queue-Id: 3CDD6C002A X-Rspamd-Server: rspam01 X-Stat-Signature: kf6reyunnzs1tr156ka3a3ypbk5jgcji X-HE-Tag: 1680099278-256531 X-HE-Meta: U2FsdGVkX19BVKhvut4WcWuat4ZzT3Y2XPATziGaVtrjbovtIggjpLW5WgyrQNPUhuWSrE3D4gF0Mvc/6Symasgso4Wq4cZgnpFuFvaahjsIQkqMduSq2Qnk1RC5KrYf8kcVlY+KrdQwQFUF21c2TKWZWrNrer0Y+3c97t4jGzgMQuHbAiKHjgCGANgrR7ePAFOzS46boN5fE9smxouigTkq+9U3uunrjlCqfRsmyFSqvrhvLXp+pUGUewm+qDjCxxGkVucU+WnPZaxk4v51s898U9jVeZJgac4bSNzUjUG4FflQds5a+qLX0bROfa0lb6vY1022scIgO4aoWUlI9QDLzEiOG4KrCWKkPHH3rSgarn78Bpk+iIdjOnAMMh/lYbj9TBvpzTTg+nbjKOaQnooKTLZG47pbFLkUDclGiRZ/45b/DJ/LPr/+bBxen82mCQWy/5jR8HkkI4agzC4XwcrSLOGy+VQNSx+7JOKPq8lD0WxNd4Rul7nMo7deNYFBo5RlcBmVYrzve5Dc0WlQmDCl35IRJl+7BkStXThllRARlqsx9ZT7WJ6S08cO0YrqCj2si0E0SjeeVqxrOJfojd5O8HGjq5LTIbR0C7b+8OMhwZvjM/Sxd5bFHX4/UmL+saFEf6L8x97sERR1cSGjNvf20a+vMrNlEZQyLHsCzRwW852ZYmmZMTygGomREwIQQQvShVSp68yBuPmmtu9i69CnxZw3j0/PWngNDBzrs8zfcn4fz8+HyqSYhSUSIBhq8IzJBp4KUfWByDNOi2ZsChIXkVe+mcry4nuXinzPTVZWgqc8zxu41yFk1AGGp5bFdvVgDnb5t8iYy3T2k3LVa0BzQ0KfC14VR3nLMnkJZ3sB0bxL9aPrMgFv68J76yPo8VoQqhp4P0frxne59LbLpwg26RrDCwEEdre/RP91IvMGQS0O3E+hTYqoqJTgTLTZ0xMav6NEYY7r4Hh8IaK o8mhNaUL L3C/RH9aTSMLGjX/NwrvA4+xOmhWU2P7XDxvDGoOCes3BeAAZI47R4ggGtNUhGJwl27TEwL2OWFTB3Uv3qpbqhR4OKu3f4V+ZK6xOjTOuM5S6aGxSeXfgMI1AXH7IkUuwYy/TFs6XWVdNyEQUXnWCmYOdtduc9sHxXpNS1tRdvXk5JG75PXekQ++BAtN+zFcQ6tK5Ui11l9Hy3sPoGpLjamzbn1Lm7y2UEMxUgMrFy5PFHatlZCKMqIG3169wGG2YhoRImfXNa3PIYkM95aXF8awcDbycVPdV1iP9Bl0mqGKGM18JMidwiRtOScxNWVwdv+huHibhxVh9uraVaV7Og88MlXItDwGhaZrSaLxKtJEqU7wesnb6OTeECwMlSZt0p7bIkhOVe4QkBjbzNc/PN9eRdaYS3qpadR6xM2O0t9Sp7ETokYe3W4LrlO1AgozikXYFt7dYMJFT4bhDwwzk+0ZOjkJVPqpy+iHVjSLGsAlOeDXAX7z0wFiRThb8/mVDIdporPG1UfVTxz3Ud5vyTufrcxYn6EBMVAR1NeqAO66C7/bbG0iNxtLGWw== 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: <linux-mm.kvack.org> |
Series |
splice, net: Replace sendpage with sendmsg(MSG_SPLICE_PAGES)
|
expand
|
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c index 872b80188e83..3504925babdb 100644 --- a/net/xfrm/espintcp.c +++ b/net/xfrm/espintcp.c @@ -205,14 +205,16 @@ static int espintcp_sendskb_locked(struct sock *sk, struct espintcp_msg *emsg, static int espintcp_sendskmsg_locked(struct sock *sk, struct espintcp_msg *emsg, int flags) { + struct msghdr msghdr = { .msg_flags = flags | MSG_SPLICE_PAGES, }; struct sk_msg *skmsg = &emsg->skmsg; struct scatterlist *sg; int done = 0; int ret; - flags |= MSG_SENDPAGE_NOTLAST; + msghdr.msg_flags |= MSG_SENDPAGE_NOTLAST; sg = &skmsg->sg.data[skmsg->sg.start]; do { + struct bio_vec bvec; size_t size = sg->length - emsg->offset; int offset = sg->offset + emsg->offset; struct page *p; @@ -220,11 +222,13 @@ static int espintcp_sendskmsg_locked(struct sock *sk, emsg->offset = 0; if (sg_is_last(sg)) - flags &= ~MSG_SENDPAGE_NOTLAST; + msghdr.msg_flags &= ~MSG_SENDPAGE_NOTLAST; p = sg_page(sg); retry: - ret = do_tcp_sendpages(sk, p, offset, size, flags); + bvec_set_page(&bvec, p, size, offset); + iov_iter_bvec(&msghdr.msg_iter, ITER_SOURCE, &bvec, 1, size); + ret = tcp_sendmsg_locked(sk, &msghdr, size); if (ret < 0) { emsg->offset = offset - sg->offset; skmsg->sg.start += done;
do_tcp_sendpages() is now just a small wrapper around tcp_sendmsg_locked(), so inline it, allowing do_tcp_sendpages() to be removed. This is part of replacing ->sendpage() with a call to sendmsg() with MSG_SPLICE_PAGES set. Signed-off-by: David Howells <dhowells@redhat.com> cc: Steffen Klassert <steffen.klassert@secunet.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: Eric Dumazet <edumazet@google.com> cc: "David S. Miller" <davem@davemloft.net> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> cc: netdev@vger.kernel.org --- net/xfrm/espintcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)