Message ID | 20230518130713.1515729-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 711A9C77B7A for <linux-mm@archiver.kernel.org>; Thu, 18 May 2023 13:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14386900011; Thu, 18 May 2023 09:09:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F632900003; Thu, 18 May 2023 09:09:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFE40900011; Thu, 18 May 2023 09:09:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DE99B900003 for <linux-mm@kvack.org>; Thu, 18 May 2023 09:09:46 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B5BD31607EB for <linux-mm@kvack.org>; Thu, 18 May 2023 13:09:46 +0000 (UTC) X-FDA: 80803407972.15.C6E0FF0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 337D8140259 for <linux-mm@kvack.org>; Thu, 18 May 2023 13:08:21 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XHi4mq+J; spf=pass (imf23.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=1684415302; a=rsa-sha256; cv=none; b=YeOmtKI8Cu85w1tcAWwio//JvkX469+gDXdFb8BYSAmHd70ixXNoXeySEXBqVyuZ84vVYi NgqSRsGGpUjmQZ3Bx1BquUqkbdkSMare6mJv+v+ZyCFB27bWekigKOJX2qKY2IVxcaVK2v OOzMX/iq6iF8qEKkQCRQsoJgFJXsFmo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XHi4mq+J; spf=pass (imf23.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=1684415302; 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=5dEuCyEYbAeTLbptDWG+lpG3TePaGyDY6iKA6gIr8Gk=; b=dMndARiqwfkDKXHcokZeQvxe22SCqRjMliS1l/4wdthBiVxFsdaWHxbclJFNxR7/gs+DHd VrryNTQxqTzNlkGNllRmpzYfqbXEvXTwx2fg697aM/6aFLiv3ogx+negnUK0L1394J7gx4 4xR2NwFerWnApCqVp3urRfVLMqW6JRg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684415301; 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=5dEuCyEYbAeTLbptDWG+lpG3TePaGyDY6iKA6gIr8Gk=; b=XHi4mq+J5nzrw3HKtAV2E8dTepBd6HQ4m9q0gGwErz3J7Rawtw1OnSk6uShLxcrPZyBpNR 5ea56cLriBTAxCNSqTV+qKg8eQG69AJnRVCnZ2XqGvR5X39ruRjETH8dqwEsKvju92gDz6 tOfL/pjPzda/ByIpbpfazR7fvJIzH8c= 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-638-lV58l2MBPkWSA52mh6FUSg-1; Thu, 18 May 2023 09:08:16 -0400 X-MC-Unique: lV58l2MBPkWSA52mh6FUSg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F4D128237C8; Thu, 18 May 2023 13:08:15 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 397681121318; Thu, 18 May 2023 13:08:12 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: netdev@vger.kernel.org Cc: David Howells <dhowells@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemdebruijn.kernel@gmail.com>, David Ahern <dsahern@kernel.org>, Matthew Wilcox <willy@infradead.org>, 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>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH net-next v9 12/16] ip6, udp6: Support MSG_SPLICE_PAGES Date: Thu, 18 May 2023 14:07:09 +0100 Message-Id: <20230518130713.1515729-13-dhowells@redhat.com> In-Reply-To: <20230518130713.1515729-1-dhowells@redhat.com> References: <20230518130713.1515729-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 337D8140259 X-Stat-Signature: x8ure1ey1uujbqz53adx1rumzypy9kui X-HE-Tag: 1684415301-36948 X-HE-Meta: U2FsdGVkX1/vAH8Hff/fgT0+0M6Gs/p0U6tOu2hc6ftIY/9dnrd2wHGQq0xUi6vX5oe9hb7lfRhpxC9Q+wW4x7T6KqbdkBRt8bWTReW4N+8VsCXWKtljJDLgjSy2oR+7e7KNyxoDpmCgktS7JxOmUxSOUx736D/pzFdxHwban6OEJ9+OVgI4BPpf2fYuTMzTaagmtYNRsLr2Pf0oo8mfJTS7W1Z7HM44qw8xuAlbMQB4HCnULtSiSwG9E+zI71ngncIi9mT95InxW/pvze1YPZZDNsnLsZCKSyLU8qy2EamxTJ8I7Fl2fs7TIKO9zMBuDs4RbQ8b0w+Q7wbRURPTDVAUrjR4N56UdGh7mi4heYAQsVDQJ4cU0Pt5+nOMo2HqODcYc0lq8DLInXMIOVQK3anlOUTY+0xJqTF1c8+N87RbG0NsOVNPpBSDP03Zu41M9bGknnx5yVljPdzjmKvrS6JqMyH70NjHzQNsEraEi2QPy8X4sRbf/4ORN73X7iUcOEu4LzRtxNvBz2fYKNb1wUtVxa9QbNh4PEn84GkvErwRiotyXVKrbksJg3/vGhNLvRQB+yLmLtyZ3Bck9uor8v8NjbRWGcLM4rUKFQbqP5QqtllohOVVthlsmZscaV2mIWGRoBekqUD/YLumoxJSw0T/KnVPRzbZbGGaSzC8oE5uOMe2El2zRDGzC5z5frv6Bir9wOu2tIOaqvpraxq4CK2RPeLU77SdQRKIUc3TkXARA5MCSDljHhNJZCeTftZTaktNIdl1s+NbKyKHrpoWNYvQtvth1Bf872sAnxkX5NZbxCQH7PRP/30XHGThP2Ac66k1WIo/i+/WTIVNjaRXzEOoS1+AdSvQu07pwVeQz3XBrMS63Sn7XhOS7832W4/N0QYIiiJ/EuiSkYIirlXjSQqvqzeHJI8HNRvvZAGdo83fowU6jRbZBRI0l4GK34XlLixysnkUe2XC3Jqq7PW fyFGTXqL JwSqXjZazLS/7AeNJZN376tB/9OrqEYmik9kmJoRBXpc0Y/Y+q6KlwgojGTgJGMsMmRQFRSwaodNzfReRwmaxEya4kqmIFEsc4fmAGzdeodUEKlL7iukoFCB7f7mjvMgK/MvgJLLusD+XZYtC3NPvvWzQgtDSs29wXmfhoPjDeu9d1u7SXG+56ty0geOM+Rc1JaIo7noTfT206D5hKb+D97mFxwKYpXN30/aKNvSbkE3UUpchMruFIuAowUgF4XRAdSGChwrV3KtHcpwK7qG2p5S2lKZ4hW/spD4a2hyrkb6+7kFl/NZcgk1JCONIoHNRylZ2wuKAhastV9hDDYDpqEUUZ55jQ1aAy8AIT2f3tpcP1nUEJQLtGM/NcPU2nG76dZd7XMh36na4Xl/xRN/WEVfZNwhkND5pcDrmUG8zBWt85GOwzNcNG16lezA7QfjSepNpQ9iDmcwbu7tOo059so4QKe9wCShEiH3+KdlmWVUo2hpbRR5QEOo2d42vQa3IrIrJ32tKIcZufHw= 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), part 1
|
expand
|
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 9554cf46ed88..c722cb881b2d 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1589,6 +1589,14 @@ static int __ip6_append_data(struct sock *sk, skb_zcopy_set(skb, uarg, &extra_uref); } } + } else if ((flags & MSG_SPLICE_PAGES) && length) { + if (inet_sk(sk)->hdrincl) + return -EPERM; + if (rt->dst.dev->features & NETIF_F_SG) + /* We need an empty buffer to attach stuff to */ + paged = true; + else + flags &= ~MSG_SPLICE_PAGES; } /* @@ -1778,6 +1786,15 @@ static int __ip6_append_data(struct sock *sk, err = -EFAULT; goto error; } + } else if (flags & MSG_SPLICE_PAGES) { + struct msghdr *msg = from; + + err = skb_splice_from_iter(skb, &msg->msg_iter, copy, + sk->sk_allocation); + if (err < 0) + goto error; + copy = err; + wmem_alloc_delta += copy; } else if (!zc) { int i = skb_shinfo(skb)->nr_frags;
Make IP6/UDP6 sendmsg() support MSG_SPLICE_PAGES. This causes pages to be spliced from the source iterator if possible, copying the data if not. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David Howells <dhowells@redhat.com> cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> cc: David Ahern <dsahern@kernel.org> 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 --- Notes: ver #6) - Use common helper. net/ipv6/ip6_output.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)