From mboxrd@z Thu Jan 1 00:00:00 1970 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 B89B0C61DA4 for ; Tue, 14 Feb 2023 11:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232647AbjBNLEE (ORCPT ); Tue, 14 Feb 2023 06:04:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232035AbjBNLD7 (ORCPT ); Tue, 14 Feb 2023 06:03:59 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6513D234F6 for ; Tue, 14 Feb 2023 03:03:56 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id dr8so38987401ejc.12 for ; Tue, 14 Feb 2023 03:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GdzfPCmVHJGyNX+E3E8axbyUX3GtR1Oh2TgImoToI7E=; b=ednkJZYRJrS0R2qMp7dMjiY5/E295iRlaB31w9ihVtnIAMOV0PYjYJ0bUgl+fdCYDB 0nySuoMmVkCUk2nnTQRCQ9UurtE2OAzUShT4WRpDW3XDeL23fyrQchl2nNAer2OPMcch za6ywzuZT4iuSPB7pBWcIogfKh9Pxx+ltjH5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GdzfPCmVHJGyNX+E3E8axbyUX3GtR1Oh2TgImoToI7E=; b=uWcm+eyroil5a+dqRh+RskP/j8tqsq2LPwrOXFheAe9CkXOs+7GCIjMRSkodNdpWNP Q/yp2DC5UfIPuHbB9UwAjuAEcqaAO92w1WMtBJYKvAQbgRaNknU1qA3P/cNEQuD4nVJ8 6vg3mH2hUvgiIhqMFRy+ijO+38o23OwQu58nTGps+lcRVqEj0bKv8dhimaGF167wf5/8 YSMuxhtLsUsNiGe+LfGCyXz7fuM8SOaQk5wHRTQ618v0Elt2xhVAv1Z1vUwityAv6Pmz teUBSERxmpArjDo93WsVL8vGV0QKc4iqDK0UUP0WvMGaemrJ2WXkSruIZKoOCMbXDIeq 1neg== X-Gm-Message-State: AO0yUKVml1LYB16gbv3vHyO5pfSL42zXu834ht2FRBj9/h6VKmR4h9Ks UgGGI/mOVy9DUuZLr5SXLBwKe/rWZlDzUqQgdXodbA== X-Google-Smtp-Source: AK7set+WvUcFXeRoTtYGMf94EhUoMJevx+ByBygwMUIuKnc04+TQ6ZndZqpuUbrMuhp2ugN16oem+2f4IsHNxbEVu5A= X-Received: by 2002:a17:906:8591:b0:8af:43c6:10bb with SMTP id v17-20020a170906859100b008af43c610bbmr1006905ejx.14.1676372634939; Tue, 14 Feb 2023 03:03:54 -0800 (PST) MIME-Version: 1.0 References: <20230210153212.733006-1-ming.lei@redhat.com> <20230210153212.733006-2-ming.lei@redhat.com> In-Reply-To: From: Miklos Szeredi Date: Tue, 14 Feb 2023 12:03:44 +0100 Message-ID: Subject: Re: [PATCH 1/4] fs/splice: enhance direct pipe & splice for moving pages in kernel To: Linus Torvalds Cc: Ming Lei , Jens Axboe , io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Stefan Hajnoczi , Miklos Szeredi , Bernd Schubert , Nitesh Shetty , Christoph Hellwig , Ziyang Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Mon, 13 Feb 2023 at 21:04, Linus Torvalds wrote: > > On Sat, Feb 11, 2023 at 5:39 PM Ming Lei wrote: > > > > > > > > (a) what's the point of MAY_READ? A non-readable page sounds insane > > > and wrong. All sinks expect to be able to read. > > > > For example, it is one page which needs sink end to fill data, so > > we needn't to zero it in source end every time, just for avoiding > > leak kernel data if (unexpected)sink end simply tried to read from > > the spliced page instead of writing data to page. > > I still don't understand. > > A sink *reads* the data. It doesn't write the data. I think Ming is trying to generalize splice to allow flowing data in the opposite direction. So yes, sink would be writing to the buffer. And it MUST NOT be reading the data since the buffer may be uninitialized. The problem is how to tell the original source that the buffer is ready? PG_uptodate comes to mind, but pipe buffers allow partial pages to be passed around, and there's no mechanism to describe a partially uptodate buffer. Thanks, Miklos