Message ID | 20230411160902.4134381-16-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 1259CC77B75 for <linux-mm@archiver.kernel.org>; Tue, 11 Apr 2023 16:10:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E3A8900002; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97CF390000E; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 661D8900002; Tue, 11 Apr 2023 12:10:03 -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 455BA90000C for <linux-mm@kvack.org>; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0EE6EC0586 for <linux-mm@kvack.org>; Tue, 11 Apr 2023 16:10:03 +0000 (UTC) X-FDA: 80669596686.10.7D86E2A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 2CA282000A for <linux-mm@kvack.org>; Tue, 11 Apr 2023 16:10:00 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jDogx6jL; spf=pass (imf13.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=1681229401; 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=TEhCbtxSk4TMLvu3MRYCcpyvU5YZgAJ2W7fFU6gbWbo=; b=WdBpDV3+Y7JeX0SWtxU0bLlFpblN704G8gGly/IB1iT6OxQyOSLDjanH+4bQNZIQXp0x8a gbTRA5nAZKlehzZZgSD/OxUkx/JZH722hIQPfZ0u4qNhlrqImywts9RQw88tv8RWSFUysT wPn03Mv9gjruAWmB4daLbOTOCf/m0XY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jDogx6jL; spf=pass (imf13.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=1681229401; a=rsa-sha256; cv=none; b=Oa0THOQh5kaAyyA3iDJ/DwdyaUFGzsM9uxt3PJLYXq75m4bW3WaOGzW4+JvT7TgJQFSGP4 u6mSA6r3lZZqNEXSJyfceo2TxRxtT/Z5IAWygQT3oVagK3r10M2qzXAj3MhStUXG3Nt0KJ WAGbY+m561BJStldbfZcfYnyHT1D4mY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681229400; 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=TEhCbtxSk4TMLvu3MRYCcpyvU5YZgAJ2W7fFU6gbWbo=; b=jDogx6jLrYmnikRKHODKH31/xuW1J6Pce6xbYd/QySlQk08qQgacPuqbrsBex+WZwnMXio DvcAIBsFTnkcwkBDFW2uh+1nmW8zGeJCJl/GGZrEX+8ofqjIQQY6hMvGBwxJAIMQI30p2c KcvvJwQrg91Zi+ucd2UxSOYAC2af2jA= 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-260-nNzlZ67MPNC336uggXNYTg-1; Tue, 11 Apr 2023 12:09:56 -0400 X-MC-Unique: nNzlZ67MPNC336uggXNYTg-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 BE0ED2807D62; Tue, 11 Apr 2023 16:09:55 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2A98C15BB8; Tue, 11 Apr 2023 16:09:53 +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 v6 15/18] ip6, udp6: Support MSG_SPLICE_PAGES Date: Tue, 11 Apr 2023 17:08:59 +0100 Message-Id: <20230411160902.4134381-16-dhowells@redhat.com> In-Reply-To: <20230411160902.4134381-1-dhowells@redhat.com> References: <20230411160902.4134381-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-Server: rspam04 X-Rspamd-Queue-Id: 2CA282000A X-Stat-Signature: pbgwddzg1o168zx4qdfkoz5mqx3zaskx X-HE-Tag: 1681229400-96543 X-HE-Meta: U2FsdGVkX18rkgpuaBO3jIHfBMB2HDgpDxl00uXAZTG9c5VEfTZZpBo5Cou01+MEwwVmcvNNZ3aGAtc6m+XQyy+FDf5A00ITHuLpi8xWX9knLzZ9t9gVyzlySweuPuVNNzBbRrMNHCaihZqpaAHrnlv5PkH60V2VJo26gI3z9Rm+Zq2RQFfr9m0HvCCx8ygZvthw+h2GlmQ37WQzRf/WsJC7oDGGVdwoH5IffROq8T9XylXf5dTTpXdKFk5ev6DBlOLPUrc6ms/d08Y0lBf7hUDB2PsB1tC+9LP0AbVGndIAy3HbXiHI4ol1gcwW0NM9zF8SFwu73OEX0kChvuyBNGIRgi8coyyoBFFQTBWrjtCEEaEWmu0qvdlON8x3oCXS500YyGdsYBiXiWuSGpidp2iGxD1Liv2AR0NRn8J3YCFIh1XlBAee6sXIIo0PHOSWzWWbKKMcvX1RawtEvg1L1cCdjIPPTBbCnL092Hsz4MN1MVA3+ZYYNSmdV0PzHovt0WzN4R7138l4erF1gwnZRaH25NUeqmJKshJy5fCPVs8g4DsDpyXUM9zQHusXXGDm3shCcMOgdFs6GSQQw1mT1QnumxnlUEeJLoUrcqxNPz1Uy05VzUv80aPZP3MP/I7oXLSqIl+VCQU/5a+m1+DBZeL4MRIEINgxvD4cbt/PMftsii8F4IHXDO7CuTxIykUCigNG27wxsF+8l/hzSqHpTUQJ3NLakNK85VF7gXRPp+maaEhb8pNWtAsqKyyK5sfxkak/dw748DjEykd19a8BtkK/CUkbMwBMces3HGDFJZgwEPhfQ9qUecKzWux40fWk2og1K3JeOb7QV7/ZMOgCyIJIk3jg97DDWjCUevqXNROM6e61t3GPk9PMhYldJ+XqarpV5R2sfGY0UXsedXwO2yEz/s138924A1UMrA1nyZTIkSHGEwRNIUaMsut8XofkaJQMHv1JBUjeXA01mVD /V4JT0fv 3cBy01dzqaxIqzEbHcry59xP/KXm725VmPA12zy6BFnKMYR+vwsaHvrqe3EUaCeobmOjXDYISIpzQO88zet7sBpIs3O1XmfM+2XJvLDlhMsN9hfVUsaVpmh+LLRKgUClycJEX+j3tUD10XsgoogLomhKo7ookd8CaXx8axDJ6DFyo59sFHeCqxpTXmm9dpoCbWQteeccEw9nXKT8SbZIn1OBtJ/pQshT1fqM3Bd+ZbbkthMWqXlwG2gMfYO23I6z7kcoVcaQLEyCMm+7Jep0/7FRS1Ynui0ATpeONQF6ZkROGSb8I5xzBMX/jKa/5b/ehOoPQOt5EBKzyMrFRkaUd+4If36Nz9d63ZcxqU1nYRa66Ii+PLJOsGa+EtH1ljZm3igDGTkRu4PFsOSCdMfm63083ZdfvOeXQLDNYYb9XN3CjfcJOukmzrjLY2Fq1zT6jaaC0tUUjPUw4EcU/Hf2lGrsDitX3v04fGOETHtxDKqS97genmygrnwfHKwLWwVppIqTqBs9yNWoAzEglkGDbDydFYA== 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 0b6140f0179d..4709abee5966 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(+)