From patchwork Fri Mar 21 16:14:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 14025733 Return-Path: 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 91E44C36000 for ; Fri, 21 Mar 2025 16:14:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90CE2280003; Fri, 21 Mar 2025 12:14:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BB0A280001; Fri, 21 Mar 2025 12:14:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AA9D280003; Fri, 21 Mar 2025 12:14:21 -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 60030280001 for ; Fri, 21 Mar 2025 12:14:21 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A1401A9D2D for ; Fri, 21 Mar 2025 16:14:22 +0000 (UTC) X-FDA: 83246055564.29.A5E4A6C 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 0B965A0020 for ; Fri, 21 Mar 2025 16:14:20 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="F/ijzHY8"; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1742573661; 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:references:dkim-signature; bh=r/FYjqrm1cAaAJapi0Y0E/iGdoYerOobI/I6FmFCbNM=; b=k7KmGY99DAOH0D76eghKVS56G1WK5j1H4eiXbXY0JlpDF/RSYRaCFtGPx2F0L9NFLXc9GH hS5KXLl7SOrUDWZueW7uaEcfLrwD22UIyG0p736PW4odze+UGUQJtqMaKiMbP5PNoYg53A L/JZyrVfXE1sQS5JO8xcYL6pVV+9M4g= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="F/ijzHY8"; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1742573661; a=rsa-sha256; cv=none; b=2suHknjovMKAdp0vXN75C5Yu41G8eLPItN5jZPH4AkKLr6zMTjeTvj+A01+YHR63chAIWm jgpdy9shUaOiZzoLYXnESk6oNbgSqpdGLXn+oSlpI90jiaXBzYg5MzgDfSi8rDMqWGa4Xx OLlyT6Zg6oS9f6OuEmoxRfcTzoaKR2E= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742573660; 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; bh=r/FYjqrm1cAaAJapi0Y0E/iGdoYerOobI/I6FmFCbNM=; b=F/ijzHY8bJ9J/D/M45RYlw+XotVhgsqNeA9Ix0qo2knxTn34Gc4S+sXjVkVvG8bIsPuH5q qiTbprD2QelYLbeZfD+6ZtBtVYAFy79mkQyTuv38ilswbXw1RViP0/M6eXEte8CPNZG4et gyj9GTa9uJR5PBnJnpvHqbH/YUr8/LU= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-583-ZVfXcCV0Pz25ASpylU61oA-1; Fri, 21 Mar 2025 12:14:17 -0400 X-MC-Unique: ZVfXcCV0Pz25ASpylU61oA-1 X-Mimecast-MFC-AGG-ID: ZVfXcCV0Pz25ASpylU61oA_1742573655 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2CF751800259; Fri, 21 Mar 2025 16:14:14 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.61]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A9D7F1801752; Fri, 21 Mar 2025 16:14:10 +0000 (UTC) From: David Howells To: Leon Romanovsky Cc: David Howells , Christian Brauner , Matthew Wilcox , Chuck Lever , Steve French , Ilya Dryomov , netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/4] iov_iter: Add composite, scatterlist and skbuff iterator types Date: Fri, 21 Mar 2025 16:14:00 +0000 Message-ID: <20250321161407.3333724-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Rspamd-Server: rspam01 X-Stat-Signature: xpic95zuhs4wfgxcf4agbbap669gueou X-Rspam-User: X-Rspamd-Queue-Id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OTNKF9NNupp7do4s95c4xUPBKet6mKuoPL0oaxQhTMDmPAFPSdhKzUXRJVzfyaE= 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: List-Subscribe: List-Unsubscribe: Hi Leon, Here are some patches that illustrate some of what I'm thinking of doing to iov iterators. Note that they are incomplete as I won't have time to finish or test them before LSF, but I thought I'd post them for use as a discussion point. So the first thing I want to do is to move certain iterators out of line from the main inline iteration multiplexor. This code gets relentlessly duplicated and adding further iterator types expands a whole load of places. So the DISCARD iterator (which is just a simple short circuit) and the XARRAY iterator (which is obsolete) move out of line. Then I want to add three more types, for now: (1) ITER_ITERLIST. A compound iterator that takes an array of iterators of disparate types. The aim here is to make it possible to fabricate an network message in one go (say an RPC call) and pass it to a socket without the need for corking. (2) ITER_SCATTERLIST. An iterator that takes a scatterlist. This can be used to act as a bridge in converting interfaces that currently take a scatterlist (e.g. crypto). It requires extra fields adding to the iov_iter struct because chained scatterlists do not have have a rewind capability and so iov_iter_revert() must go back to the beginning and fast-forward. (3) ITER_SKBUFF. An iterator that takes a network buffer. The aim here is to render skb_to_sgvec() unnecessary for doing crypto operations. The patches can also be found here: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-experimental David David Howells (4): iov_iter: Move ITER_DISCARD and ITER_XARRAY iteration out-of-line iov_iter: Add an iterator-of-iterators iov_iter: Add a scatterlist iterator type iov_iter: Add a scatterlist iterator type [INCOMPLETE] include/linux/iov_iter.h | 77 +---- include/linux/uio.h | 37 +++ lib/iov_iter.c | 675 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 710 insertions(+), 79 deletions(-)