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 9607AC636D4 for ; Sat, 11 Feb 2023 18:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229483AbjBKS5a (ORCPT ); Sat, 11 Feb 2023 13:57:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjBKS53 (ORCPT ); Sat, 11 Feb 2023 13:57:29 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A222199E1 for ; Sat, 11 Feb 2023 10:57:28 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id gr7so23138771ejb.5 for ; Sat, 11 Feb 2023 10:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; 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=3PcKjkZEscdfAV5ya0phdN14wwNaXoRb40kNT9Dczeo=; b=YHVu5kUXNJwub6fL2bFRhFub6fqpPJshyUtgnUVxZxBIopwouTR/KgSkKN4JSR5uve Wkfn8LbbiLtb+QLkrXegG9Ji77YU2cy+xueHjxfB9bGAjhzAGT4k9x0ToEiwbgOMILfW LyuiuxNGORWZQC9nxgiaZUsmJDUDBv4eCG8b8= 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=3PcKjkZEscdfAV5ya0phdN14wwNaXoRb40kNT9Dczeo=; b=TsJeX/ejSN/Zgbp1McHRy+HrXNScB7gDvb0Q/rC9hQKn6IOFTb3ZN5dZJ6bzePjCsv RsCMx3QRSlg48WCQT3p3b7Pjn8vUu6a1rR78AGG9h/2Kl1rDFAz9jql0l2JIjmVwG/+c 4cR6tAYHkSd8CRXs49h2DYSe7WCMHl028kCRWx9sVwfOKrlSq5MeJGkGt+GvohHmT557 ZrJ0vYbB+v4U/AJN/ju1wnmu9K2wTETXrJkCO040ufZO+5CQDf+7197RkpC0dGyVWnqb x9LrFwZyWZsl+hi3mg41WnCItDluLVSygVDWlZUo0gyc6WDD59m93zhTIHkFJNozW0wN E/Bw== X-Gm-Message-State: AO0yUKXDc3SzS+Ke3Ku8/MF5sH54ixyerpNIYmmLGnn73OUZVkVMFfSr 2bSi7shydyVgNSVnkRObK1Ae7LTgHGUrwqofxhQ= X-Google-Smtp-Source: AK7set+CI9acTTwtWXy9/I+gMyn/5DwMHXL2nvE4uKEfenod4AlxKQldUopBQewP0DKHl3YLRpYEow== X-Received: by 2002:a17:906:33cf:b0:884:930:b014 with SMTP id w15-20020a17090633cf00b008840930b014mr18517725eja.6.1676141846015; Sat, 11 Feb 2023 10:57:26 -0800 (PST) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com. [209.85.208.46]) by smtp.gmail.com with ESMTPSA id lu19-20020a170906fad300b007a9c3831409sm4151395ejb.137.2023.02.11.10.57.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Feb 2023 10:57:25 -0800 (PST) Received: by mail-ed1-f46.google.com with SMTP id r3so8111638edq.13 for ; Sat, 11 Feb 2023 10:57:24 -0800 (PST) X-Received: by 2002:a50:c353:0:b0:4ac:b616:4ba9 with SMTP id q19-20020a50c353000000b004acb6164ba9mr1152399edb.5.1676141844693; Sat, 11 Feb 2023 10:57:24 -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: Linus Torvalds Date: Sat, 11 Feb 2023 10:57:08 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] fs/splice: enhance direct pipe & splice for moving pages in kernel To: Ming Lei Cc: 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 Sat, Feb 11, 2023 at 7:42 AM Ming Lei wrote: > > +/* > + * Used by source/sink end only, don't touch them in generic > + * splice/pipe code. Set in source side, and check in sink > + * side > + */ > +#define PIPE_BUF_PRIV_FLAG_MAY_READ 0x1000 /* sink can read from page */ > +#define PIPE_BUF_PRIV_FLAG_MAY_WRITE 0x2000 /* sink can write to page */ > + So this sounds much more sane and understandable, but I have two worries: (a) what's the point of MAY_READ? A non-readable page sounds insane and wrong. All sinks expect to be able to read. (b) what about 'tee()' which duplicates a pipe buffer that has MAY_WRITE? Particularly one that may already have been *partially* given to something that thinks it can write to it? So at a minimum I think the tee code then needs to clear that flag. And I think MAY_READ is nonsense. Linus