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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 626CBC05027 for ; Fri, 10 Feb 2023 21:15:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233676AbjBJVPM (ORCPT ); Fri, 10 Feb 2023 16:15:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233621AbjBJVPG (ORCPT ); Fri, 10 Feb 2023 16:15:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456CB75369 for ; Fri, 10 Feb 2023 13:15:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7362B825DC for ; Fri, 10 Feb 2023 21:15:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75616C433D2 for ; Fri, 10 Feb 2023 21:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676063701; bh=drRLjPO4W8+vobf8j+babenJwUZfGHrCgtm3IJwcsus=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AGLnYFgLKy+YhfCfkM1bGCROGcCQSbUArwTWq/wrlakc11E9Us9MyNRJmPAa8be4D lbFY/87EwlQ+YO6rgQhZyF/JooJyUJxk32Sh+J2j8x/twmDH8GVy4iJB/+x42bO3qX d+k/JfTTH460RskhUBu8sqM+xDiV2ENLb4D/PU6HSt/JzgV8mHDD04/8VdDqaPmxqG LRPKsNv+dmazkmpKNFF+bbg9DHFNNp1JR/jE1Ke2R0qxATHDQNTpiCSa8shiMYc00u hjkyYF1hrmZ8jtEXwnqFhpcNDb+wZqB4WJB0GhoDeaIJ/x/M3fjnqvDIxn4e8GqfMj TPU2pvEAZAYUw== Received: by mail-ej1-f46.google.com with SMTP id p26so19000747ejx.13 for ; Fri, 10 Feb 2023 13:15:01 -0800 (PST) X-Gm-Message-State: AO0yUKW71ePQeOWTTU4GcPGZfruos17dw3XzpqGSFJwrU9TAXd8d1BBu oDji9ppq/nsXEWDFrnz6q0nCwzB8s/0fEfFT/k2gKw== X-Google-Smtp-Source: AK7set9sEOO5ys4u7C/tRckoglukBzYmZj+BAQtrVtXnjQZf+0QEmL4y7t7SUVX2wYHEoZAGGzrKjZLjFthvZi/MV4U= X-Received: by 2002:a17:906:fad2:b0:878:1431:2d03 with SMTP id lu18-20020a170906fad200b0087814312d03mr1667395ejb.0.1676063699709; Fri, 10 Feb 2023 13:14:59 -0800 (PST) MIME-Version: 1.0 References: <0cfd9f02-dea7-90e2-e932-c8129b6013c7@samba.org> <20230210040626.GB2825702@dread.disaster.area> <20230210065747.GD2825702@dread.disaster.area> <1dd85095-c18c-ed3e-38b7-02f4d13d9bd6@kernel.dk> <7a2e5b7f-c213-09ff-ef35-d6c2967b31a7@kernel.dk> In-Reply-To: <7a2e5b7f-c213-09ff-ef35-d6c2967b31a7@kernel.dk> From: Andy Lutomirski Date: Fri, 10 Feb 2023 13:14:46 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: copy on write for splice() from file to pipe? To: Jens Axboe Cc: Linus Torvalds , Andy Lutomirski , Dave Chinner , Matthew Wilcox , Stefan Metzmacher , linux-fsdevel , Linux API Mailing List , io-uring , "linux-kernel@vger.kernel.org" , Al Viro , Samba Technical Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 10, 2023 at 12:50 PM Jens Axboe wrote: > > On 2/10/23 1:44=E2=80=AFPM, Linus Torvalds wrote: > > On Fri, Feb 10, 2023 at 12:39 PM Jens Axboe wrote: > >> > >> Right, I'm referencing doing zerocopy data sends with io_uring, using > >> IORING_OP_SEND_ZC. This isn't from a file, it's from a memory location= , > >> but the important bit here is the split notifications and how you > >> could wire up a OP_SENDFILE similarly to what Andy described. > > > > Sure, I think it's much more reasonable with io_uring than with splice = itself. > > > > So I was mainly just reacting to the "strict-splice" thing where Andy > > was talking about tracking the page refcounts. I don't think anything > > like that can be done at a splice() level, but higher levels that > > actually know about the whole IO might be able to do something like > > that. > > > > Maybe we're just talking past each other. > > Maybe slightly, as I was not really intending to comment on the strict > splice thing. But yeah I agree on splice, it would not be trivial to do > there. At least with io_uring we have the communication channel we need. > And tracking page refcounts seems iffy and fraught with potential > issues. > Hmm. Are there any real-world use cases for zero-copy splice() that actually depend on splicing from a file to a pipe and then later from the pipe to a socket (or file or whatever)? Or would everything important be covered by a potential new io_uring operation that copies from one fd directly to another fd? Maybe I'm getting far ahead of myself.