Message ID | 20230518130713.1515729-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 DC5BCC77B7A for <linux-mm@archiver.kernel.org>; Thu, 18 May 2023 13:08:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75F9A90000B; Thu, 18 May 2023 09:08:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70EA1900003; Thu, 18 May 2023 09:08:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5895190000B; Thu, 18 May 2023 09:08:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 473A6900003 for <linux-mm@kvack.org>; Thu, 18 May 2023 09:08:59 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0A5471C764A for <linux-mm@kvack.org>; Thu, 18 May 2023 13:08:59 +0000 (UTC) X-FDA: 80803405998.30.C6A5966 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 8460D80161 for <linux-mm@kvack.org>; Thu, 18 May 2023 13:08:16 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IZPfQphn; spf=pass (imf02.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=1684415296; a=rsa-sha256; cv=none; b=2MBRpXnlcbJpUujml96Jy9y7GFOaiQ6WXUd8IM1dxdubA1kYr8acTmsXM6wCjn1OHiOD3M thqxvHfJIa8Lbfz5CJZAnbYSxrcfH/2pYmkHBhgwzjB0ItTDQpsM+tW78pQObi8hnMZ50F UyyldkR8AdCHUuZX30qQP+4H17Km0jA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IZPfQphn; spf=pass (imf02.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=1684415296; 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=TxfQZBIaVYN5Ww5L9z7Bp5BeAsSZ4kaUNwqnOhX5dBqnxmrg+g6c702WksF5h/0S/P12AS qWL2bzCXqa9hW0qQDO5y6ciOcAmOHCgIjCMevpxmvFVZhsNknDnqxkHbB5AXVNCmmZ8D5P 4QOuzYac9//vF7zlb9WnmdgdWhVtR1A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684415295; 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=IZPfQphnxvTxMtTbxTtjCHZJUQrTcR7Dv8VJuWWvOzvw7GkbZ4AOnljsqz4quz8vfHCiSd IN64I9ELnjCxoQUPnlclu6phuNyXDseh9aygXcQoh6glXYz0YyStdNpRhmFNeqQzXVluGr QrA5KqJZ2DQRwHgCcl2bNMEfxpEO4iE= 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-255-IupZrLRDOgiU6UQOydG1Gw-1; Thu, 18 May 2023 09:08:12 -0400 X-MC-Unique: IupZrLRDOgiU6UQOydG1Gw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2621484AF2F; Thu, 18 May 2023 13:08:11 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0967F40C2063; Thu, 18 May 2023 13:08:07 +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 11/16] ip, udp: Support MSG_SPLICE_PAGES Date: Thu, 18 May 2023 14:07:08 +0100 Message-Id: <20230518130713.1515729-12-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.1 X-Rspam-User: X-Stat-Signature: wf88wtuxkdk5em6n1skgimzcczmz18f1 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8460D80161 X-HE-Tag: 1684415296-371341 X-HE-Meta: U2FsdGVkX1+XzJCmcK0HMQFCrgYo3lVP75pLWSvqphIfoFAhImXaWsNeJkZ+MGtYfpUCbzc4Dc2QvTLtErTjXn5WYsJeCClrE25SGwNhhK8vEbHAA/aAfBtvsD8yJ4xBRU7h0ukRGq61p+zNSbmUy3E11O+EaYnRtiVTXqXWvH+Z0vCfg1f7Dq7plJXmXc0c7mJOexPKTzSwX+nD4Qalgd027IG/SdJdkgqk4j4WsRsdhzbiSQC3nu7X9c+PA5rkOmqmBNHzdCJ4JODQAaC6s8ysF9119qFm4Gu5HiPx+LYRumjvu0p5hRBP6lwZrGkb201HVrG2eHl4wXs3jZkNkHZVRIZIf5SxTctk51LsmqZD57O/K8dhq/anHv8zaewIByo75PhOtZoM6Rw+c0tqXOTKkz7m5+WRIwo/5Z8EYPrNCQSdXCEn7j16TT+gcvOSU+4Lq+orOIWdJ4zqPXxDh45UDAaDLfsrRoav8dKp7CdavRdFeixhrVho825vaufOQC+jGOXu7UbLAn/f5aAkrHkhuGfzrYj1RYzES6ejo9zCRXVwD0pAmY/lWfOyL7haBXoRKGr5ZiuDApT6eGyUAfMNteMKn2aP+dr8eWvUF2LNyb/H6jPKQ/afuG2jCDY8+oMYV/al9kZ3zhSRAQq+Qf939XStbOfLiPDfu8FfcfsawvMSgp2IblkYdXBBieXodu2EsJfUN0BFvgCBv/gKTUhSQ5XusoMNgWo7ruYOvdDshFXAj0hPSFqwsZJYnjQfRWDkYk8zIFB4ynA9dU4sr2fowpFwRi6m+DUbLbpM0jTPhlvWEjlnWl1CmAUbyvPrjvRllX7wRv+BZhj0Dn/NuIusU8RS5anWMqwWdnJT5iOMl/K2Ay04FvNSaCqq31wL/ByoxLyRQbfqFeu0o1B5cKRCduwZFbF5iXoqc4xppLbTdj8OVZ1ZKU4HRUZtnTYybwyzFf/YBVixeUFvqWs tZoNOtF8 m14T5X3sCoh1oteKaFGk1SGE8SOYkEApNQeFVv827NMjZW9OSlJeEojAWpV6GevSUq/ACuRqk6bKXzAoiECJ/tSevy/DvejNAzibInC2gFNvSP3y8WJ8WplQBksIEip50jta1QVQH03la7WkjUE9s5bI4f0y7U9p2SfsjpzIoaUDWKQnr1lm7PSi6wLjfxeXfung2qRZwLEUh/etqWSaF9AZ9iq/cUofAxXvqBCDvQZfwQGJUDVyoF35+K0PeDxyKLYBASy3O8i+uN5DMnht+pNdByaFtkKUukrSZn52uXIaA+DUVrNcUDMZZLvbLCmuakkhl/HjxFGCsVZeukadJrFLleurA5d2uhWVardSkYldufeuRSL9YFRIhfGos3hFnrUOGoeoHs2qAqjSdCygLwnzfdEeKJXL5K+8W5aYriSCXhKiYnfncbO2QWGIXgcd1bTDCTMi4qWE1eUsuP4XyAwD3r2kCnXefc38Xv6EGcCTutRFzhE6y8NPNA5D4orSL0oHHhmgaYSShYw0= 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(+)