Message ID | 20230518113453.1350757-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 ACCF0C77B7D for <linux-mm@archiver.kernel.org>; Thu, 18 May 2023 11:36:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C060280009; Thu, 18 May 2023 07:36:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB05900003; Thu, 18 May 2023 07:36:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24CAD90000D; Thu, 18 May 2023 07:36:01 -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 0C6A8900003 for <linux-mm@kvack.org>; Thu, 18 May 2023 07:36:01 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D396C1407AA for <linux-mm@kvack.org>; Thu, 18 May 2023 11:36:00 +0000 (UTC) X-FDA: 80803171680.22.2B914EC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 11107180006 for <linux-mm@kvack.org>; Thu, 18 May 2023 11:35:58 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CGnwbFrC; spf=pass (imf16.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=1684409759; 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=xtuqtcO7szTVDFOyl+oBuG6ttBAXG34tGHSnm7PhP+V3kaQVSbXMOm/Q6La1+ParVs4QaA 9bYx0dVXP8EM/zDajZ9q49Nmg6Qlha/GY/A4IvA8YHs7DoWHxfXHYdSV6mEQDF/i/ctLcN Ii7fj4y6qkCgqZ7zOckAAgAMqtXtLMg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684409759; a=rsa-sha256; cv=none; b=mSSg659OjxAHdD6OtLMS8fTUCFFJ/nXv8ThJuEc3QUcxuDUWzRFLs0BOteTKoPTu2S/ph4 6PjphHNxkSmFr3uq/SPgR/8Y17kXXdaVQ/QL+12l/aI79ltJn6e2ElTI+W3fIonCG0oUWa EQ2HhNlsym/8tGWS71Ghd9++0vhdSf8= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CGnwbFrC; spf=pass (imf16.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684409758; 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=CGnwbFrCDxOc/8OkIFX/JbeKvZ65dWhs13s6LrviYH/rIYiWotwStagBjADwnA/Tg3XbMg g2CIIavjbCiAoxymvB9u+TC9SLKv14AWuCpZ4cntkYJy7Df2fKhRld3BD3TeXADJX1C9Sf GH8xaIy2i3q9kavLPTbzlVsj3F7xSRI= 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-668-jwZ3dLuJNq-_aRCVShqxqQ-1; Thu, 18 May 2023 07:35:54 -0400 X-MC-Unique: jwZ3dLuJNq-_aRCVShqxqQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7959E86C60C; Thu, 18 May 2023 11:35:53 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D35614171C0; Thu, 18 May 2023 11:35:51 +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 12/16] ip6, udp6: Support MSG_SPLICE_PAGES Date: Thu, 18 May 2023 12:34:49 +0100 Message-Id: <20230518113453.1350757-13-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.7 X-Rspamd-Queue-Id: 11107180006 X-Stat-Signature: qtbj1smq94a9ekygidtmrdguihfxp8mx X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1684409758-42015 X-HE-Meta: U2FsdGVkX18yY0ZGo9qR6rK5sqw6LgqizjNY9fn1s+a3e+ODjosvvxDRjMgmPB7h51U5Mf7f2ypaccGB1aycp5bVyrwqz1dmBgVqIEbg1QWF2AuBa1la1Nmww6arZ3agNw0JlKGOFTFTiE+B4j5Nho8JpXoA16GbjloUQplr1Hqrq0KxA+tdVKM4WqRfdCi6oIopnZ1F+2C/YtVg4SyyHPSnSiZPbK4OBCGSZ1TbsjcYZUOiV76Sq0pxty9bDyntJft5i3UNOLutDtIc9d9GOOz/Wzh3R2MB+3ODoDBgSx6HYSLanMSoFcXBWsjqQs0JmVjXrU19AYr5RLeJJ9XVRxI2n+F/4OMP00P51RmMIg1Hvag8GPrAXu03wSVcgdVu979AWwD189GP2HVZXhFlUlWqDblE5i5630SS1qDEONIzm5AgL6zfk9xH4/6JmHV97DJTgqWaj+CMYss7al8Ts8/fzQXp3Q7OVvIQ/2D3mi/qOsiTQED65zvuZXRpq225xIeP3ZX9I7Ogck0yAzKlLQJfMU1Y6Fd6HmXBQDqmKXGYZwbezdUQwplzbyAbDt0xRlI5fJxrJZmR5UeAdcVPiKYmkOVOZxEb/LeBrJlQDWUBpXjf6FSbs/dqZlWyUOgD7ci2z2oOzZvQDqgZVnjtyizUOgyqv8CRW3SIw3r3iFQyy8H6AFSNVh1ZJEWUWZ46XrPRbQ+G2envqWy+yLy/4KPKQSRjtjXPXrUzNtP3Fq8uLutu0y5r57DWcyBbIl6tR3H+Qlu5L0ra5rycVoxPOIQJx0szJeEyn8wIm6lsrJASF1BPxth0s4uqg3sMj9SwmNExd3E0C8N4iaMpaMZkFUupr/U33NdMIvFgwbru6y6Ter4yPzpNU+ajT6lHBXq2+I3HGYA7Dz/x0Z0FlNky/Lzb9zrLDeiwduDYeL/0hxtsVbGqLWiNR6bKFF7K3wU9syDn5zT3Ur43Da3YbPn Wq9NZgXs ZMKWrUZLo2P4onDTtnxyQ+7w+MTifTh7kWg37qnC4pGKga8t5SbL0eL1yp0/KVY7Cm0Euivnu4x+tt0eLMRWxN52oT4CLLj1ilSaS/zp3Lc5OOgCXCU7F0ZUcxFRJ1J3mEHKYfQdLkh2TLRi+nkpJZbMHj6rpXLZuudQo9j89lZqm1v/qH+CnsBBepm+uNWoqEqc/OV2WvPZg0AYZgN1OZcDYs2T7i6chR+JBgPVG7WLU95I/K+mDajxDOweGtBgaBHV9sB0gOXyhmZcd7RS2+xvCovy4LzqhiNXABaqMfLgCa1NdGAz+EWS87EnT4Q0983Tmf0UQPTiOn7hnSyZHw2YqcrA4sezA2zUxMTe7LnKgAQ57ySNzF7G6zUX/HgSeUKWwCITmv35Nenf8hcd7Ml5Vi1lTo6GInrUxiSV9/OCyoSIsbPSh57SzAX/0cIlxnp2FCm8Xs0g3GhdRgnBYP9Pgza8dL0oQyllOCkNkRpsJ7X6Ol+R53gUy9Zak2tnMbj6D7fmP0QIMh+E= 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(+)