Message ID | 20230329141354.516864-15-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 0CA39C74A5B for <linux-mm@archiver.kernel.org>; Wed, 29 Mar 2023 14:14:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 990566B0089; Wed, 29 Mar 2023 10:14:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 940BD6B008A; Wed, 29 Mar 2023 10:14:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E12A6B008C; Wed, 29 Mar 2023 10:14:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6EF126B0089 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 10:14:46 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 47C17AC2F4 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:14:46 +0000 (UTC) X-FDA: 80622131772.03.B13463C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 5DAB8180017 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:14:44 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J2E+o2T7; spf=pass (imf24.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=1680099284; a=rsa-sha256; cv=none; b=wEM8AXpfS9oRn/5dbtjRPBdK6JGw+IpkT9RePQk+F6NCPdiMrU9ojVB1brrx4p1wLQ+Ptn i8R5lZ+7FHOSGVjbhNi47hIZdAE46AkB0+QMFI+e0XzqYBgJCMsEdnfwnXlX16AmnnvhVc CKEhzIWDa6SFJw06hpdRBnonLIoIing= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J2E+o2T7; spf=pass (imf24.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=1680099284; 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=pP5V7G7GRqo/82ZWWApO+0CTJP1pdqvbg0H8r7V6l6c=; b=YuG8L6VGif+HbgLqoIa/yIErJCWIs+lDXG45Q/5W70GeHD8JXQtIDV5u4Ehn9L7ESFpm8O PGBNWtkTt6wgzxa4R0WhYYOgjoI34vFxzH3iU+SaXckWXovHoT2HqTPttmbeNPq3BW/Omo 8bb0Ak23QcQWhJ3+y2rTFVtl7Waurws= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099283; 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=pP5V7G7GRqo/82ZWWApO+0CTJP1pdqvbg0H8r7V6l6c=; b=J2E+o2T70kAFGxqLvoobWVTTSaagIuWVpnsUWOWlG1ZpQmKRsABLDEvZtwsaq5wjxEm6SZ YvQ4n+KOMk5B3xQgRh++Lj7vGNjC9udt2gHU8KBRjb/xAZTgbKGEgLxO8CvlTTDwMwvdm7 Pei8i+IIxXWaRWQYx2FpkLFR34N8124= 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-387-i4eZEzSqMsuAkK3bbaUC_A-1; Wed, 29 Mar 2023 10:14:39 -0400 X-MC-Unique: i4eZEzSqMsuAkK3bbaUC_A-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 9C7CD801779; Wed, 29 Mar 2023 14:14:38 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 715D0C15BA0; Wed, 29 Mar 2023 14:14:36 +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, Bernard Metzler <bmt@zurich.ibm.com>, Tom Talpey <tom@talpey.com>, linux-rdma@vger.kernel.org Subject: [RFC PATCH v2 14/48] siw: Inline do_tcp_sendpages() Date: Wed, 29 Mar 2023 15:13:20 +0100 Message-Id: <20230329141354.516864-15-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: 5DAB8180017 X-Rspamd-Server: rspam01 X-Stat-Signature: naz5uo43nk3xcns7itywap47m1badxip X-HE-Tag: 1680099284-741091 X-HE-Meta: U2FsdGVkX19UFKcDTG9Vh/W3er4/8II8aVizM/YyjtDSvDaDpwd0NOP10K3FCwyBcZ0onq4F//9kGgO+8fAfmM59D1AnWdYa5iIJkELlqXYETZASFFDZT6/Izq6a/p3MIoU2e+zxDzZF2uo51NEr1vN8NIX488GC42M2kx2gMg3Hb+q1Q7XzCEqD/g5hXmxUiP4TWbcPDSCEDS8TvS3hmLM9aTyZ5Jh27dFNFB7mAwYMD5syDtN4luQ6zaG0/uo+wkZg2RkPVWscUrzoY2ycJQVECvjhWa9S7Lmc47EbiEUnZWqhvc/AjH8b4aUJKonEg3C3RihV9aKAF2e6qONHHCfZnml6w71l+wERAXTyfu3cnbFB0hbhgf0rErxsDWNryzISOL4CM5tim0NC8yPwPcjzK+HqVnmVem51GYRgrMy010ggkWLBLJcDCBuJTUg8z60aHCXuuOLv/zfGc/8U5wXWwkDK3cjrF1HD2gbJcEcfHbloEgxYEvW0TZZmH7sa3AOL2mxel8U29e+cdg6dLKw8x1Z3V1OtPA0S1KevQD8visiiz3j2QRPSNOTCP1U+Bnh5s3i/dVXIG/j5mIdjPIbT7VqGoaISsMgKyYnwtbmHlMBi/QnkfsLcpcB6lKEzdkb67hv0olb2Cf2T8UI6kQAa/F9HCMwV/q/rJIkiXssTMU2kQCt2IKR3Dk8dH4ds5C2KLxhPdTlC19BHhiV1Ijdshn1vQYIIT1OrDyUOFow6Iew2SQW15wAMLYpCIwNbnf5qD7fkHVfaF8h4YSJRJY+UpVXFn/ahZRJDGOn0ZHjkP3GcD3xBlyw1ilaXXoWgbkaIpnwt0RC8N2X+dr0UgvOn2oPTtbGqb7PgF9mBQ5dC4TOmsVYPejRPm+usB4mXqSPts0pt4lW4WGUY/RyrNh3qmmwctKyJUSINtyJxKb0J0L44H6n9Q2xME02oJcoXyCRreSjdXFaZ+sgBLq1 3vtSF3Lg QrcH/ZxgmByHFejTKXfvL56fd0aFKzYqNGKZtASIc58zNdWSr/BFWCz8Jq3h1F8/OVy9SJ+Mj7KRVnxlW6XKZL4roa9RqXGwLIGDf0j9f/KDFX90ESZahQJNxpvxEu/ebSuM4zWUxQNOgtGxQaY9VFMcmajiB62t1tTIrETlIAr6nKyaX6pDTlOlM0TFX6v9VztZVR51ljUs9HWDUxIgRTTPgdq2wEaE4Gqq4jay8EJEbW7CFnaLwm8I49LAK7C80A0DusYMx3xVaJJhhmJTNJ54gpCHsG/mG4rnK54zY3oopI+iRqDtxZ6y9QOlx0Eb4AvIPgYAHAW5oPOYOt+5Vml5HnrgQKmTS0eFw+Y070WbGoebvJoL9nPB+YQgytumTtVOhAnEHQTHYqnpxyfEjNIdPAFOWnqrkopCTlG7jv5vKfsTXS3xmvZP4VS5MSgABOsiBzOQFNZsjSOKUeiI6HPMIC69dmNLBhKTFIxMOVeTd34RZxTc1LN6yAQmDoSPUttsnPyPoF+TL3MQ= 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/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c index 05052b49107f..fa5de40d85d5 100644 --- a/drivers/infiniband/sw/siw/siw_qp_tx.c +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c @@ -313,7 +313,7 @@ static int siw_tx_ctrl(struct siw_iwarp_tx *c_tx, struct socket *s, } /* - * 0copy TCP transmit interface: Use do_tcp_sendpages. + * 0copy TCP transmit interface: Use MSG_SPLICE_PAGES. * * Using sendpage to push page by page appears to be less efficient * than using sendmsg, even if data are copied. @@ -324,20 +324,27 @@ static int siw_tx_ctrl(struct siw_iwarp_tx *c_tx, struct socket *s, static int siw_tcp_sendpages(struct socket *s, struct page **page, int offset, size_t size) { + struct bio_vec bvec; + struct msghdr msg = { + .msg_flags = (MSG_MORE | MSG_DONTWAIT | MSG_SENDPAGE_NOTLAST | + MSG_SPLICE_PAGES), + }; struct sock *sk = s->sk; - int i = 0, rv = 0, sent = 0, - flags = MSG_MORE | MSG_DONTWAIT | MSG_SENDPAGE_NOTLAST; + int i = 0, rv = 0, sent = 0; while (size) { size_t bytes = min_t(size_t, PAGE_SIZE - offset, size); if (size + offset <= PAGE_SIZE) - flags = MSG_MORE | MSG_DONTWAIT; + msg.msg_flags = MSG_MORE | MSG_DONTWAIT; tcp_rate_check_app_limited(sk); + bvec_set_page(&bvec, page[i], bytes, offset); + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, size); + try_page_again: lock_sock(sk); - rv = do_tcp_sendpages(sk, page[i], offset, bytes, flags); + rv = tcp_sendmsg_locked(sk, &msg, size); release_sock(sk); if (rv > 0) {
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: Bernard Metzler <bmt@zurich.ibm.com> cc: Tom Talpey <tom@talpey.com> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> 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: linux-rdma@vger.kernel.org cc: netdev@vger.kernel.org --- drivers/infiniband/sw/siw/siw_qp_tx.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)