Message ID | 20230331160914.1608208-51-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 21163C761A6 for <linux-mm@archiver.kernel.org>; Fri, 31 Mar 2023 16:11:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B7966B00B8; Fri, 31 Mar 2023 12:11:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 466136B00B9; Fri, 31 Mar 2023 12:11:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 307A46B00BA; Fri, 31 Mar 2023 12:11:45 -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 239546B00B8 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 12:11:45 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DCE1E1C6BA7 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:11:44 +0000 (UTC) X-FDA: 80629684128.21.FBC826E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 3AC754000E for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:11:42 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HR+JpLyf; spf=pass (imf12.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=1680279103; 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=V7IwXZpp4caT5icSmRzfTKcX2kIg430bJYtEqUuaqXc=; b=L6MBcyvNR/3i1X7EV/5adnGtejHcWd2lmmNKIHwDh+Byfl0w2hQpTuTV8BgbJBqu4YbzmO MKzZBeoE4gpj+QAZhX6gBIUDdR1eAAcBhpt0SbqpQMdG48/plHO9O8ipA4Pxj8PtUum6en oWgOZZiKo08txeyTxNz8EEp8qIiRuyM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HR+JpLyf; spf=pass (imf12.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=1680279103; a=rsa-sha256; cv=none; b=Q80k7ys9pn+9laRbcE7WFkuaumQqOSpgo6lbObYFUb5h874XD+HrBXMTbs5C01vNAm1HLO x5CNKJ2Bmsez4W43/5L1CTHMg69ukNNp0ABnx0wbZmDAHGmV2fWYQZE+RukLwcAKE2TR+p obaUyh98nphkXZu9XjXX+SOpHLb//0o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680279102; 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=V7IwXZpp4caT5icSmRzfTKcX2kIg430bJYtEqUuaqXc=; b=HR+JpLyfsmERPk+W195XvE1hJaYn/vsz22nFHZL+g/tFAKvRKevTgQlEO2KDhCQ2aUSSbr p58oASrjvRSRiuFDbDGa39GI9DJxueh/1IQF96lEvAZIVXseaV9pxZXU+MrrOYoh9eHRqp aqh7WrnXw7U1dK+whR5AWmXuK11tCoU= 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-499-KUirUmF0P5GTXUc33yxBYQ-1; Fri, 31 Mar 2023 12:11:41 -0400 X-MC-Unique: KUirUmF0P5GTXUc33yxBYQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2135D10119EB; Fri, 31 Mar 2023 16:11:40 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 120582166B33; Fri, 31 Mar 2023 16:11:37 +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, Tom Herbert <tom@herbertland.com>, Tom Herbert <tom@quantonium.net> Subject: [PATCH v3 50/55] kcm: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage Date: Fri, 31 Mar 2023 17:09:09 +0100 Message-Id: <20230331160914.1608208-51-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.6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3AC754000E X-Rspam-User: X-Stat-Signature: str1euck67cir4bxqkdtyn4htmjq18oz X-HE-Tag: 1680279102-151839 X-HE-Meta: U2FsdGVkX1+x+OK9YsKrxbsFoMMRB7WBIFn1txdghZjm7/FuneFnbb8M0yKMvNwO5ZH3mfLdwRatPKpJfRf1JKLccpiPnKuGSSsmR6PHX2G0J+DckV+5om8CRatoui07lAO68zgpbzUQmPjLImvFmz6TCMxKd0V2cX4q93xdGeqfAsDLTDpd4i6atLiKE0NtQjjRER4I6+Zr5FWqaYQLjX7Gl5LC5tjnFwkywtZIbAGFxZuLcUnJlD2lDjYzXsQsf/DaG1gL1lmxaDDuLNi2qsCgB5rka/sl4heDo11zKmTaHxX0quHc8rkazsQfOhuF0H71FRPpS7EVpyzD/unejgzRwDbkMk32KfDBSXKSCBv6KF15NQy9lPScMqANSkTQpOFALRMMGtRZtsa1CbESebPS/mok6Y2GSGZPNeU50Oi7CR1AuJFhtT/gD6ZxbiYSjlmEWObOHbjNSaDzjx3OFgk2S56xH+dK4OkVlpPIB3f9pmxUyaba5s/ht+71CepTfKSak/JETX3opXJN2z9CaT+5oazw2Sk9TXXaXN0oqje772mJg7Y0tYs2wHtnDGL1++pX4jIEJu7V/nRrvF0/XhJXXjHZsuLV2g2PIY/yoqMSL5+jaKDvN9YyCctjX+PD2OHEiLuMHR5HGCS7wHvVdftH/ktnwD1xSz6SUWjhIZ6I0byXsC63XIy7CgzHPuA/ppuT+48Z+owUJLmixnV0ZkjZmxX0yY8UqhQFVRBGeYchNRlZt0sbkkJW0peg2euLUsvVNAxbUDjD8cLEWDLBncn39+49LrYgCLyGku0+FCnfzSVfn72xo5zDevsCgmzwMZHtAWLTb/Gz/nmG6iB2rec5BPFiGWBygIQq8k4TXc9ocs4SFVARc3giwHKeCxHyMzPbBUi1tfcqBFNBjp8ruXk+qfGyadGW0ptoefrNoyyAEOo9/ayckQBQJR3uDkd/ctjHcijvdj7GB/ws2ML agvTfTRo kz0icKCTNEHFM075Wg6xM3cwPsEeWncd9WK5IaSJiAjGz63t1emiyg1r50F4sxaMEVT3yifaeHJzxyPMBPr4pemTlgTq633Z1K2dXyVBde2A2y2qmm8bVBnwtVDHisoINetq+aS5yrGIOU54DJbG+qodoEvYvPZj457lwefgv3dDL/ncY7DBDJRecqFKr9ogijF/U/3k+q6/miQhlnOvkXoXnaeQLxxuqfWBSw8JroXCTQsHcvIhdBW7nVLx8e8x6fpga0brQT6j/PT9Q4lVoOO6VIZOGvQ+QEvBFJU1nXwv+2CkRdqscCKkq7jz8BiXbSJHsgYCQbGFPdDi+8j0aluhG+NRR4leIciRJrbDgDrlW7Ac1zgaJOGYD/3jrxffuttPIjciuc6LN13TJwNyrzBRzlt39DpdSjPTTDhxIrB7K5eCX574guqh0PN2524f7PpPrwMhCq7apzkOvFyRy7t5ILvkWSMjy3Vrn+mtYjt8A5TJrSQi32Dgg2AyjTIRHr/11AJ7sUfK7kCrgiUocGHOcTwUPoBGFQZwJbhPp1d05IfYxK3LjfIdJtQ== 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/kcm/kcmsock.c b/net/kcm/kcmsock.c index d77d28fbf389..9c9d379aafb1 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -641,6 +641,10 @@ static int kcm_write_msgs(struct kcm_sock *kcm) for (fragidx = 0; fragidx < skb_shinfo(skb)->nr_frags; fragidx++) { + struct bio_vec bvec; + struct msghdr msg = { + .msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES, + }; skb_frag_t *frag; frag_offset = 0; @@ -651,11 +655,12 @@ static int kcm_write_msgs(struct kcm_sock *kcm) goto out; } - ret = kernel_sendpage(psock->sk->sk_socket, - skb_frag_page(frag), - skb_frag_off(frag) + frag_offset, - skb_frag_size(frag) - frag_offset, - MSG_DONTWAIT); + bvec_set_page(&bvec, + skb_frag_page(frag), + skb_frag_size(frag) - frag_offset, + skb_frag_off(frag) + frag_offset); + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, bvec.bv_len); + ret = sock_sendmsg(psock->sk->sk_socket, &msg); if (ret <= 0) { if (ret == -EAGAIN) { /* Save state to try again when there's
When transmitting data, call down into TCP using a single sendmsg with MSG_SPLICE_PAGES to indicate that content should be spliced rather than performing several sendmsg and sendpage calls to transmit header, data pages and trailer. Signed-off-by: David Howells <dhowells@redhat.com> cc: Tom Herbert <tom@herbertland.com> cc: Tom Herbert <tom@quantonium.net> 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: netdev@vger.kernel.org --- net/kcm/kcmsock.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)