Message ID | 20230515093345.396978-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 910D5C7EE22 for <linux-mm@archiver.kernel.org>; Mon, 15 May 2023 09:34:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B22D90000F; Mon, 15 May 2023 05:34:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 262F8900002; Mon, 15 May 2023 05:34:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1032390000F; Mon, 15 May 2023 05:34:50 -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 F062D900002 for <linux-mm@kvack.org>; Mon, 15 May 2023 05:34:49 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C4678C1423 for <linux-mm@kvack.org>; Mon, 15 May 2023 09:34:49 +0000 (UTC) X-FDA: 80791979898.13.7E41033 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 0900D120003 for <linux-mm@kvack.org>; Mon, 15 May 2023 09:34:47 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gqV2PDOd; 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=1684143288; 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=pVPqXvIjCrEjYGVudaDtQ2U4ucwmIQE6dwmksiJvjcSqvrc3QGztIh/wXKwQ4Ltlepx4Ku OyByCBmnZhpk858EKXjV0nfPC6+mm6+scZyFmnbhVLs28UGfSHuh+JnivDhDeabVBRlLCn idMnTkwws7UmHE5z0SyDT9UnrO1evf8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gqV2PDOd; 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=1684143288; a=rsa-sha256; cv=none; b=LiqCGtwy/DEDrl+XqWS38ZDBt8K3GPbnnQu0V/lKYW0J9XLPBP4V1tiQtsn9R33Qvaot9d D/e/QLCDBb396hqHkpU2AIJCprb+Nm/xVE36NxYxNtqnmsUBw1j8viDlLN7PLwAdOrzcQS 3PJ7nbGs/jJZg2Xxrptnrjh7QxERhtk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684143287; 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=gqV2PDOdSOtvhYwZyarkp9am8JU9GeNJMEcOlijk/7lq1oLv4KBqTjL8RmMHNL56hLbehO rJD+gz9VnGietzea0BN0UYvCrBmx7zzbILA5G1Whshr0EugBkfDtN/UBUK+x6DXGBm1p4Q dIg6OI2HFeZu/eOsaoxiw4pmP71REfs= 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-196-7yv7CbjeNdu0aC-6W8LDyw-1; Mon, 15 May 2023 05:34:43 -0400 X-MC-Unique: 7yv7CbjeNdu0aC-6W8LDyw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E350870820; Mon, 15 May 2023 09:34:42 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id AED6840C6EC4; Mon, 15 May 2023 09:34:39 +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 v7 12/16] ip6, udp6: Support MSG_SPLICE_PAGES Date: Mon, 15 May 2023 10:33:41 +0100 Message-Id: <20230515093345.396978-13-dhowells@redhat.com> In-Reply-To: <20230515093345.396978-1-dhowells@redhat.com> References: <20230515093345.396978-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Stat-Signature: c4s1rmigjmj5fnaqnq741drqw67ffqy1 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0900D120003 X-Rspam-User: X-HE-Tag: 1684143287-40807 X-HE-Meta: U2FsdGVkX1+QItQa0hjOwwIShkUyVmBH7Elme8J74klcHuHqy1MGD2yTkWdE6hxJ9N6C3pU1dUze6yoFiih2U46u/uffB/DX8Jc47O61EfsLB1MNJ98y5dSAfYebqi3HU08ueah4BgfzEGyOnsVMRnokGTpHgWFhU7mWYOlU5I1ploA4HmREc833cZaRT+h9DOztqEbanSHMPd6mnVUpmpGMXpgwShSpt30p8LD3Y9YF6f/VODM7Fs7AVFKD+Z5DYTJxNOHT+d0dUAF8xD0PCHYP0SuZIBkM1GBCRSHX5hlBo7l3G77iOHUao4kGsk5DbPOsVSnp8SIe97rBTwt3i0ysQlRMg5FDrEtxxuYzUOxkYMjhcW2839YOsyZGgZFzZ9PXoNhrT3e05wbtrW/HZs5UfoKnv3aFwd45dAyRy0ONOFvvm/nioU3IP0DpHNBq8NbOMjH3CxpU1qTXPtcDxy09fwio9X4RNfq6YvaefxMz5wbpUOGN9RVz/02YisN2I0YaVKndwMEnx1l5TGP2I/VwmKHEgOXxiPWeIu5JiA4uEQCwXlc2f8iLG6Av93woPOILX9DR3sKxg92Ixr6M3o3wjWsDKbH/ZtBee2G8lgzxboWuiY3GznfV/vkWM9JuXp0gRl2Vj+xF+SYEpxsB+12BnV6DcAQk62QiS4lqkFlkZoNIuLpJUajyRrDRwrnTmulgRdwXMA88o6Hr0VrrTlrj4JJKhFwkm+7tiHFDLrU3enUFz8J5BAU9vgDuXr+d3TkUVQaZnoAiqD33904RA1EmACM5sGc00pqAc1rgDcR0q2v9IfVEFNCTznkf0hK4SG3EyxHA8hH2Di+4n1inQ17UBrkc3eePdb3WM1u/Bn44IUY5uvPvd4zsuCdgBOH7zJ9OyeNMoy/+o71RJ7ikvSQoMp7oq34kflXhRSkHSZsh1s3s7/24825aXurThTZuZEHsNefChZqWJr8kaSq ZFpv9hCG YvT/4GHYwhfbzuEXmWBXD6nd9yynrOfAvzkR5P4D1lbIXa0jqKd1D9pghW2LIabLyecZHjjQb/M/PSd76/evk5HYRFz39VBW+uKRK5DiYKVA50hjNY1DqIUe5fSLBVzWgJ/sXtiUEHCye5+PgM/94dGiEL+AG+ZO75Jdd7EWwTdy3lEQbiaQLbgNFFDUU0b964MA7aC3DAh3W3YgvoEaSW27CfTDNadECE9bn2maU0klMHmaxzigdWuUAcO2+6Of6R3AQUXjId7W2JMNYlHmxl1T9ck4imuFi2mUlyVDOAXGTcAzXo5uvECKpYae5jAxRP0FylnPfXQRf6e9mdBV30FICPvBNImMnV9ObPk5pyGo7PxA2T/hv3rfWIKKB3U/mthl2Jxfjch82fwY4p59D0I8bmM+6O2sFdRS0776jPBsvptD2dbdR48rQqXKiiPJrpVbR5vuazh3mRY7CTfMbywFSXrvoTUN2bgJ3dQK3EE41XrdVXJZj8xLMYBTcIIkuTPWSeXbh7y9eEeg= 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(+)