Message ID | 20230518113453.1350757-12-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 B81C2C77B7D for <linux-mm@archiver.kernel.org>; Thu, 18 May 2023 11:35:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55BC2280007; Thu, 18 May 2023 07:35:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50B2F900003; Thu, 18 May 2023 07:35:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D2F5280007; Thu, 18 May 2023 07:35:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2D1F8900003 for <linux-mm@kvack.org>; Thu, 18 May 2023 07:35:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EFC384076A for <linux-mm@kvack.org>; Thu, 18 May 2023 11:35:56 +0000 (UTC) X-FDA: 80803171512.18.3F612D6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 3A1B2A0008 for <linux-mm@kvack.org>; Thu, 18 May 2023 11:35:54 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aotO7zU9; spf=pass (imf15.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=1684409755; 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=Di14zlocOEDECmKOzgXOEyS4sjRLATonTy1WJdIXAUU=; b=snpvK7qt1AKxqyFhHvWw/29TAmbjh/QtFXxYAwCQmsC+4ezSwYxdb2Bw0o/ESIpFlFfPpN Xw3MNeKIi6b2YFDnoL8sNM9Qr3Z1DAxwVLkrrTCXZ0V2skmp1mx8nMyead5yHXr/X7vLcK Q3YiKCalauvHN/KK9o/+uOStNpXjVoA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aotO7zU9; spf=pass (imf15.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=1684409755; a=rsa-sha256; cv=none; b=24vmFPN3J6tlmx/K4tqnuqccL4vpEswHeEgtTLjO3t9/HfPAwXykEEzFlfh4dEQ7VxuL+m YhX93UzoCxCjLcYvo46k9Eo2phTAEPwCCEzcYmeawJ6LmAStWPpi/ERqhv3jTKv7mg0Qvt DNq3v6XLFcgsJmQDc0msX2yLsAh9oOs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684409754; 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=Di14zlocOEDECmKOzgXOEyS4sjRLATonTy1WJdIXAUU=; b=aotO7zU9dz3HsZpxVBcs+RFC0QhdjXZc5SBOyYx3Td18y93Pg4VYGpk+Ngn/6LqGBQnLV5 HOHRlgTHiAiFI6M4gIx3GOArAFoZHeooVC01z7JI/8DjfyriftC2RnttVPDmBDDPffxOAI CgfLZTCMv/F8TuOeSay6qM64uFT70SQ= 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-175-D_mli70IPguE5JHBJeMmUg-1; Thu, 18 May 2023 07:35:51 -0400 X-MC-Unique: D_mli70IPguE5JHBJeMmUg-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 260A93814597; Thu, 18 May 2023 11:35:50 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB20B492B02; Thu, 18 May 2023 11:35:47 +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 v8 11/16] ip, udp: Support MSG_SPLICE_PAGES Date: Thu, 18 May 2023 12:34:48 +0100 Message-Id: <20230518113453.1350757-12-dhowells@redhat.com> In-Reply-To: <20230518113453.1350757-1-dhowells@redhat.com> References: <20230518113453.1350757-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Stat-Signature: cfadoskcc9i8pr78uquj5ew4f7wcbwyo X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3A1B2A0008 X-Rspam-User: X-HE-Tag: 1684409754-273765 X-HE-Meta: U2FsdGVkX1+2oqu3trfjanJXxdUmbeVhDZaC656WFUGdQr1tysh7eBEN7dfB7v2PwFWoNZOlBn1T1pFpBNhDEkSgfQvFqQHCYh506h5Tta8rCyX0XFF0Eh0Heij4q9KPZJP2DLKrbysZ65pFxFye1s1ECJRebNlzz8F5ypV3f65saMzclKpu4xno3bD+Zusxs3zfYerERcglh9qcYQkpPzT1yByf5RejHXlJ45ovKGEo3vJJd3Jc6ECZW8/O9Mww6Uw48W2HCQCEIn+IgA5K4DhPm9GWNyUQkoOSyd4JWJT99vOYp2hRvrM/IazL9ewUosMhAmFkV9UCdQN3xb6N1uPdRMOCunP/t8KLHMJvtGm5POtikNSh8pVpBCPQ/dIE+Kz+Gj+E07Sf+O21FvrfOA9SU+r71uoC/sqi7oH1WmQV5E+IpzCrYXFf5iqWE3eipGUNpscdhFkRSEIvTs1Os8lFO3AC/p5A0DAVWVUjDf2fAeLTA2wCaip0jnZXWp47g2FKThhqzLKpn4RJV9nR2lBctqYAdUSMkske8yoyGrw/hPNKFb1Q3OAxIJdUapwQMa7Y4k+b3tl1BQ/z6IZXqEUvxx4PAUrs8jwrMR7lilnI1g1eqScS4NCHInie3fM6BuXGDwYVy+ZMA9adfRm3RnDFKAIve+uI2rcvb4fre6TLFuFfnbhIeP2j9Cv2uHvOLrQS2KKIm0yhlRwmhNjGlwgUmXynGjZd3/RCnS1ikwxACViqwJL93QxrxVIv1dRipE2VWz7UvMJo8hEGoQWm1U/mgakJsj8hepJ7pGVN589tYI+/UsQapyfS9S+QuKVOdHl9Js54ieS6NmvcD7NbfN+kb+9i02nCt1NFXvjg0vDb8Qa+omBiRv4zGwFHm2UvugxaaEPX25OJaYstpdZfuNKNZqvVVNvAkpnYjYmzfzkLQ1/S9KrQBNAZB/dciIdnqf0O82LGb3oXwakXNrK XLOaLASS 0880Zke4ODc5hz2gXfH1fMbiCCg8eesF5VWubKAVTQcVEz9d4ZY8IVzuoQFeWLvnXk4y2kPgppFL9WDgGx9/1a16mtoEiTw2Nu2lorzTJAUbAm3P160C3erqGZvXyekAV6uPGgvsdymz/1ni4bQEmgkejjp7o3nmhpeE1oQvN5Y8x0np3gw9+jiSsCtrGmbQkKRolY7bd9G0AoAPL/juoLujIDSHvKuDMI+TbjyUu0iMwcbiv6SYJcj7lSdllRrvToBXYhcWjHfvXEN1sSJVjyGihOb3j9jzsu9McwrKbRHHWyNvj87aJ+v5LNkNVLXRi3ZvwNrzddzOjCLvF36N0RY3159JZznUvrwDxtHm0ovV2XjGETqbhoQYIdRHsWN3R7vl01AaO+E6+MwRyLH51fzsXZxfIwjJ9dQUyV4gc5BmlrMhugZVhBCsonGtw4vniIUnoLgkzQLzkS5yHgL6VzVunRtnnAI+Arcgc6emXYaFpvj0nDpT6vurovYIno7n4QfF5RqMhKP4+0wU= 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/ipv4/ip_output.c b/net/ipv4/ip_output.c index 52fc840898d8..c7db973b5d29 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1048,6 +1048,14 @@ static int __ip_append_data(struct sock *sk, skb_zcopy_set(skb, uarg, &extra_uref); } } + } else if ((flags & MSG_SPLICE_PAGES) && length) { + if (inet->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; } cork->length += length; @@ -1207,6 +1215,15 @@ static int __ip_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 IP/UDP sendmsg() support MSG_SPLICE_PAGES. This causes pages to be spliced from the source iterator. 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/ipv4/ip_output.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)