Message ID | 20230329141354.516864-44-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 2681CC6FD18 for <linux-mm@archiver.kernel.org>; Wed, 29 Mar 2023 14:16:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0001280004; Wed, 29 Mar 2023 10:16:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B897E280001; Wed, 29 Mar 2023 10:16:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93F5F280004; Wed, 29 Mar 2023 10:16:07 -0400 (EDT) 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 80FFE280001 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 10:16:07 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 486131401E5 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:16:07 +0000 (UTC) X-FDA: 80622135174.30.C268A0F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 81317120027 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 14:16:05 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VZTDfih0; spf=pass (imf29.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=1680099365; 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=T9xMfNdsrDCo/ep+SBwQk+++P3r8+NfDYHGjOqRd99M=; b=aokjbonNtnfBn9l0sTPCREF0ocvgKPod21Gioh1pRuy358JHQYbCmYFfZA0HWVlEJo+TtM +94+4aDo3tEksGbo3YTJLzxaTSrR1qJNLSm9SWXUIuWwey9mkAnjSCoM5x4ayFhGHZMyPk 7x5x5w0qDO/BNN1U8/mIUaHrOWvtfQ0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VZTDfih0; spf=pass (imf29.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=1680099365; a=rsa-sha256; cv=none; b=BkgPP34DafeylAve1Y5eaMFWGQJJe3tF38uEGdY7wc2q5NdF1koz8FaqYxiWrYje43FvKP 5/LgvFIVHPr6EM0xgoR/RY624Ny5cIYoyc03o6WZzXPug4eWDxywerP+KBCl5RNDBFn5Ji /ZFxXC4mJzJLJacmYW64ioYfUrTINjc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099364; 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=T9xMfNdsrDCo/ep+SBwQk+++P3r8+NfDYHGjOqRd99M=; b=VZTDfih0xKpPSpaze8DW9Or8Vwt6+rEYFJd1h06L8xU7nrLDORCD7pZtOxYgF3ZsuMqrob UZrRfJ6T+6MaWAlkI8Lov2ZFQ2FA8h6Rqw/Di91D1+eOwHc2NceL9FVciY63SVdhp4KL2C R1YeFplyxtmMMN+/s6oU/4NWKhsfddc= 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-610-Ojh5V2k9OAOrBsNjIDnCsA-1; Wed, 29 Mar 2023 10:16:01 -0400 X-MC-Unique: Ojh5V2k9OAOrBsNjIDnCsA-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 7C34E299E77B; Wed, 29 Mar 2023 14:15:58 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 615572166B33; Wed, 29 Mar 2023 14:15: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, Tom Herbert <tom@herbertland.com>, Tom Herbert <tom@quantonium.net> Subject: [RFC PATCH v2 43/48] kcm: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage Date: Wed, 29 Mar 2023 15:13:49 +0100 Message-Id: <20230329141354.516864-44-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.6 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: tnagcudetsm8ggj5yigq1c8mcqpft9x3 X-Rspamd-Queue-Id: 81317120027 X-HE-Tag: 1680099365-689601 X-HE-Meta: U2FsdGVkX1830V6t+00IfsU3rgeMaFfpM2X4OSLl4Aj+RIP+OCxUaDDNb2wuy9rXU3jfw9cB5nd1jMsla1dLhwxv5PydhyhcT8vf5qU9Nx6dc5Bpgvu37t+UXtnm3WmMe6kDHBoT2WT/AkvMH5X/eFC01kXISP7HGnSJ7RbgPVjr6oMw3vcnlJyxFMD4k/uuR2uCfzyYJFdXi41aOpngWJvrc/NiQKXHQwUTvo0OJGZ16DtgcY6NhjgVFXgq/Ky7PL02cgVnG5gsh5QlzbysMWEBkedL3GpbgrKoTovlAdRnQ3g3Iryd3UJ+6GhK0yfej3VdQFzxZ1OX0J2LjkI6752iCgkKH64IjogL/oIxJ9KeT9ftjQGs4pvcjcKnAwy7VJvYheQt2ggq4/nmF0YPt1U8LlVTqJB+KwFnsZwLiwYTxC3wJujKk0LVe4NyrGNi+FsyAxPy4uu4z4moJslAsjcjW7EtXBHSmMg720pkKoP44VGQbJte6/SAmwF87WAADG3RY4GbQncARHfTPrLJtUsSH0lQF7cxNRjx+jg+1WFPMF03MQaC3MOwshgAABQJJo/6hS8S1AITx+e7ku/36n5ptbUK6HTv8pHf9tZVhFbqzRSYaKWJtmOkz8iPB4mIB2b+2iPLTxE8KvOvIR9IJGbIFzEbl2tCwQ+a6bwlA43zlymWu4LwZqSetoQcMVRlQKFsGt4ZLBVpyhZ0bI9sb5fsl1TIx6zcIMBdbop1kJksoubBrW9D91Y1WJZLM3asiU3cc7+IyDWPNi4pEGfDoKcPR53DcdJAY2D6eXihVI8lKYIPHvdBUMVtq0QA1DkaQuH75a2nRO9fOsP9bQC2tImngknB5EFkQa/GVlDSnOXTh/l1oNc93CwA2PlNYN8JBmERgV69gX0oV7OsTSZjd46GgUXJRcluoqmI0qZKk8l3cwS5au6zkoCzLjrMuTt7l0c3j0IHHs3bRUTtXXL vXDsM52W 6soFVvgtNlQ0VC8CwCgIrK9KMkHS1ZF2N+J/trPRA4OgEXwLh/+gANU1OYRBlmVVqiZMTt/GdZOZ45tMeQFw8i64NEDT1Us1hA078+8dYGUQf8E1dlGIdMJ+SgAd6umqnMAMQ9IDPjzmDW7Y2yUN5PBh/60p6uxYzPZY+rOb50tXX8hvGHMKVvTarDXTTqIxJ5M33FxixaQEV430pRISeyNZe7KqzfSojlPgLSeSz6WR6e//A9nLabL+D9hxwGBedpcpp/rdKPBzqcvqXoHxyxRG5QZU+NdeVmOlCTxwHYDiFy+AGegcqjRmh8/yJSVCFcujaYzpfnQxPAqbfW4wCsomi0ZCfm+oi/QKhtannQ2C8jvAoRANQczLuX0D9LUDIMO+ycEmDw7OCI5kcXg/BUSL+ix/hUR2GezTilD8p61vKDPcGYqjJABj64taLA5OfShkCHVYjNPlDbDqq3cOru/yTtBXbifb50lGRJQS+zPP1qwUvGJWa09T/x1DYInnfe/0B64748G3vNH4UD1KJB1uuPy1hX/LI4cHOBGqoVOfLRWQuPdTVgFyRcQ== 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 cfe828bd7fc6..819259149952 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(-)