Message ID | 20230331160914.1608208-14-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 D215EC761A6 for <linux-mm@archiver.kernel.org>; Fri, 31 Mar 2023 16:10:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 727ED6B0088; Fri, 31 Mar 2023 12:10:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D8396B0089; Fri, 31 Mar 2023 12:10:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52B056B008A; Fri, 31 Mar 2023 12:10:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3B11E6B0088 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 12:10:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E66F81410D1 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:06 +0000 (UTC) X-FDA: 80629680012.20.06F6500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id EE7C240011 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:04 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ch76O0xF; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680279005; 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=f17OEC0g2r5N7EvWMlRgym4yR+GjpxbiK3pWagtsTtsHQepgl+/t3gKvB4i+swyK+1Rmzj 2BfMMx5SZQp7QygnQk7g5XUx9KJWRBKMUcx2w1FLLBFb0WTF8xjfep1eJ+Q0OxbZN4Oo0W eIGEB0KtAhGuyzkR65X225B9dCPIfdw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ch76O0xF; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680279005; a=rsa-sha256; cv=none; b=iHbFwfjprLFkDSPXYgj/TqOz+oapuWBp8LHgVh0o+f0FQqZ8ygQ4eqaP+c4/seJmmyHco9 zCbKixTb4XucpZFc3OpQ6rienOeX+BidGBPaxAa2Wzbgc7k+MKmcodPfkRSORH88h2q+67 MC59aWckejchJ4db8k1jIy4COzvpMHY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680279004; 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=Ch76O0xFNTJ0c26mjTiKgJqTubWtPuC1ZLST0HRjXmoSKZjnw0A6KJJNtOqQ5jglnzO0iz ZuF9LReHPxxCdqQ9NiEjT3ZP6UIQAoxIQvZlnSeQYzSzaqbtBFKRYGZ1uRpnvVN5DniBkZ vfO2BJYpvcC0pvsSybnCR8VT4EzFkko= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-8gYrt4CYNxeFfvIQEREI6A-1; Fri, 31 Mar 2023 12:09:59 -0400 X-MC-Unique: 8gYrt4CYNxeFfvIQEREI6A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9D123823A0F; Fri, 31 Mar 2023 16:09:58 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFCB8492B00; Fri, 31 Mar 2023 16:09:56 +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: [PATCH v3 13/55] siw: Inline do_tcp_sendpages() Date: Fri, 31 Mar 2023 17:08:32 +0100 Message-Id: <20230331160914.1608208-14-dhowells@redhat.com> In-Reply-To: <20230331160914.1608208-1-dhowells@redhat.com> References: <20230331160914.1608208-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EE7C240011 X-Stat-Signature: f4tju3qxujuby9kurf1c4qmapw4p5ym8 X-HE-Tag: 1680279004-469503 X-HE-Meta: U2FsdGVkX1+yW4AKRk3OJHKhdyKHrLYm1jMTkUjwm0c24wEHtQUL2tUI9UIysmgB91U3X5CmpaZB98lBkRnGDIztWiczO/fD1tlGYlpV6Di8TVhl5FCeW+erieZyCRoOpaSiU/8PRr+mqtY2su5pQ3UOjheI+l768fnmnsmWAyniH0+5MmXzhGENpRljwbcjtYapKM3ZdSMSuDoxog1rU6AQlo99zUPIcBWepHM2ZNwx3GHb+sv/2lznL4BI3SQ+XMKvIbWeBGJI/bn6IHBoTot3MefaNOXVuR6aZUF0TEw9osfW1Ryn78CRELufPc5+/VSJkrJZp1K1IYmNU85cD3CfxgUs6Fe6i9IG7vhGpjbYw0zZJuHXfpn25S0jyUAPWCDSMGf6I97P2ONM1c7AB/72hzHE5fPO7FkfkNwCjFMgLOUZJ4zPXoc1yfa7hkKSZ/uP4uuMaUwH4z7Zhl24YYWIBQsTGw7yJw07pGztUuDfbpzn8hwrHj2njBsKmn0LY8w3Sr6Cd4ZKw0Gef30P0N5wXFAsnI+kMRagyteXjqjlRg4psAzFTDCR+1BozW/0PWPs6c1vBCBAkV6RelBSmxvPkm6tDhLnThAWnM/6QdRB/X5o61mozqadm+XjPH9OZ3WD8mAsMMqZpV5oelulOpvULVEsBxVKkZ4g03jkiEjxg/wvaFxHfcWV+5s2yxenCtT6V/3HPJ111LVWZ6yYQKsNSX46dXsBS2naxVMdnbNIFw12hlOzMR7WSrYJ4tquqi4SxZbWo9lMwgcpbqX2Jp+DGR4hqKk/EHYt0SQ4QpGhA5JDtOq2/sKvk2ZpV6ABjGR6TSAqbBOxtEuMKZcO09k7m/za/wyjD4aQqZbtlV+DKAe6IrkS0EJqkThSngOdVtCkR17qa+24B76sGk4duC7SpiWRsTped/p6oI2jKkwk9qx8JQmmDOhIydBizWmFOH5TmcsVIQrdt5oljUO bhfruFCd ZK4njVg0aVsa7fin16Vk83SnXR/Ngmu3qwVOTfE1jFNImjN+n7iC5vbNPatuuBnngcAStZ0DgDDfzPmTzBpcOogTfcCGdwi8HlTkdypMSl5m64VgT6DlwP9Ih0bym/W960FvQVJ3S6u0mYdfBZrRbynjW0/IA82TE7nBDWk/jY/FvAzYYT1tEFngBu69r2+7E/Fc2Ytb11XdYYPTFNvy7SJ4wp2cz0R90M52ZJWyiJwLfDrnR+a/cizGrmtaGQ4qmBZSiwlB7vvvj02lx79s1BstJPPYzWXIlKqlQtpe3sQO2nd7rJdQCUF5bjKz4SPzU9ftrhZjMneZCWz3tmrOHhxoXYgXsmP2KKMZGLOCRBzNM+3nsIvBoxzad9ayBlMZ1Su6hUYOuUc0RZC8ce3RKUwC9KAnZfrFTf89mrbIFNW+9dICT4CN0RIdpi4Vd6vudDZrQ2GKlG/97UZfEWOrmFW2vfcYberrb/uiepXcYAPFSc+xW3FTGVuZpIdzH/vdxCwApAipVcWtkaYg= 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(-)