Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6185596rwr; Mon, 24 Apr 2023 15:24:07 -0700 (PDT) X-Google-Smtp-Source: AKy350bUzh7/JNSx00EscbB/uT6elGwQsUjpGstArq+AXYFWlSSbWQiyvnkSfG1S9zduCJKDVzqc X-Received: by 2002:a05:6a00:1a53:b0:63d:311a:a16b with SMTP id h19-20020a056a001a5300b0063d311aa16bmr21381822pfv.23.1682375047031; Mon, 24 Apr 2023 15:24:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682375047; cv=none; d=google.com; s=arc-20160816; b=BVAb//BauNvDWWrY3zU+usyC46HUgAzffLjn+FrnRu2gHNYbA2f3PDlCXlLvcD7HW9 xbO3kZXU1OVY1HkjO75HVdu2Fgcq3hJ3Wr3A/M216sPUC6/aR5YmxD7uHvr5NIQK3WzX 9ha2oEHx4rbpEo5++zykP2GGXM1nSmAX4ZwZ857MUFXIhGXBqMIctGkQBhYgu7wDVP7i yN1cbpgPIwgw+xWEGpaJTQpiPro3g1RK2amjWUnKuk7A2M6eP/CSDQgju2Y+3XpxMXod RM/JEtbuu4/wvI3rKa2maOWTftKdj6+KEQuAL+mC8quwf2BfB1AOcMyvmqeyVWaXAt8w vC/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+dRw3ZuCGQ4L6hUkul9wpsWJC+pumrtpXIkrF71AKzg=; b=UApfjcjTVVqbFRjd4I2+8ELOgQZqXIxJpZic0e9vPpF9Z87mcgg/zoQJSYkGYTW9hu V0nwxIjBUWvAW8DizbnKEX4DYVQsHmyd1IOLtraTm5eex1awUntjlA09fedBtM0PZXS2 UF2pv/sCfk6D2OVnnohU4FZV2ZEqFOJX4usG//PPzx2l6NjD7sRnVUoex735uXDWD03S hz8z3uVQia05N0Nj3fBV5yIGeYvXd1ywF4jDQqG41q8cNB9cATccLf+wrSehk7Vbz8Mb cVPRGKY92CIZQhJ7s4joKqpvZvcym8KkaxCxUndsmpFDnmYhUmX45UXCIz8fzPKIfMJI c0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=3khdx0Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b005189417e923si12080353pgb.882.2023.04.24.15.23.53; Mon, 24 Apr 2023 15:24:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=3khdx0Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233148AbjDXWIF (ORCPT + 99 others); Mon, 24 Apr 2023 18:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232946AbjDXWID (ORCPT ); Mon, 24 Apr 2023 18:08:03 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA5B9759 for ; Mon, 24 Apr 2023 15:07:34 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-63b621b1dabso1556079b3a.0 for ; Mon, 24 Apr 2023 15:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1682374043; x=1684966043; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+dRw3ZuCGQ4L6hUkul9wpsWJC+pumrtpXIkrF71AKzg=; b=3khdx0Pbh7dboOsA/SQbLr+pThfrOhlsUVR9wi/ngcb/YMYufGZY1hhbwTaJZPNEv3 O1J130sRQYLR1rGY2zCd5qRceSMqVkIEoJJpxoeKvWOfYTm+sMN3RA2wWxaZ2sjntcRg yKhJG8brRG/tMc0/zViwM///8LGYNcjgDdFqwCYcIBsxMvqGuIZn1OvyB9Sw+SXUKaat /FZNXoxznzO2ful/U38P3afDzHRxMjOJKrJw39/kMhy82MAsNZmnNm/GOfbVH2KO2psN osWBaiHOIBa2RgMCUv6na9fnE7AR0tUHQwcCVpj2ubCZpkXWqPCgHNbw4yeNxslRf28i byfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682374043; x=1684966043; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+dRw3ZuCGQ4L6hUkul9wpsWJC+pumrtpXIkrF71AKzg=; b=gLzhhpXzqXiXno/MYEbUww9MsD+fXRA+OFs0VPXwDyKzfFe3XyAxNqy4MZUjtbDWGK KIJfkTE0h2gZA602SFo44aXsETYLD2rYqsTA8RApLJoI1Z6GxchWfxgwajlM23tDFg25 vScYZtljvQKk84rTY/fT6Yl6l839mGgPo3g9pyDRjzPO5hqPBiMYJ9tvVQTyPE9cBhY4 gfh+otzG5vbMtVc714ySGR4esyxZN8qHwrKa55wih3DRewYQ+aoOsOkn66FPb+jtVaqG Jl2xwopm/pan9WG6hBqK++OXdLX0Y4On1b/KUJ62/u9LggZttFkWy7kOEVwTC7ubmqur PA1w== X-Gm-Message-State: AAQBX9dgB06ycWhr5bgrf54HfnVQiwS3KRodFdgyXahAyBPd6WRLvb1z XzMtYlplWr1kWptwZSpf6LQPDQ== X-Received: by 2002:a05:6a21:9982:b0:e8:dcca:d9cb with SMTP id ve2-20020a056a21998200b000e8dccad9cbmr19617367pzb.5.1682374043298; Mon, 24 Apr 2023 15:07:23 -0700 (PDT) Received: from [192.168.1.136] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id e13-20020a63db0d000000b0050f7208b4bcsm6924377pgg.89.2023.04.24.15.07.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Apr 2023 15:07:23 -0700 (PDT) Message-ID: <2e7d4f63-7ddd-e4a6-e7eb-fd2a305d442e@kernel.dk> Date: Mon, 24 Apr 2023 16:07:21 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [GIT PULL] pipe: nonblocking rw for io_uring Content-Language: en-US To: Linus Torvalds Cc: Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230421-seilbahn-vorpreschen-bd73ac3c88d7@brauner> <6882b74e-874a-c116-62ac-564104c5ad34@kernel.dk> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/24/23 3:58?PM, Linus Torvalds wrote: > On Mon, Apr 24, 2023 at 2:37?PM Linus Torvalds > wrote: >> >> And I completely refuse to add that trylock hack to paper that over. >> The pipe lock is *not* meant for IO. > > If you want to paper it over, do it other ways. > > I'd love to just magically fix splice, but hey, that might not be possible. Don't think it is... At least not trivially. > But possible fixes papering this over might be to make splice "poison > a pipe, and make io_uring falls back on io workers only on pipes that > do splice. Make any normal pipe read/write load sane. > > And no, don't worry about races. If you have the same pipe used for > io_uring IO *and* somebody else then doing splice on it and racing, > just take the loss and tell people that they might hit a slow case if > they do stupid things. > > Basically, the patch might look like something like > > - do_pipe() sets FMODE_NOWAIT by default when creating a pipe > > - splice then clears FMODE_NOWAIT on pipes as they are used > > and now io_uring sees whether the pipe is playing nice or not. > > As far as I can tell, something like that would make the > 'pipe_buf_confirm()' part unnecessary too, since that's only relevant > for splice. > > A fancier version might be to only do that "splice then clears > FMODE_NOWAIT" thing if the other side of the splice has not set > FMODE_NOWAIT. > > Honestly, if the problem is "pipe IO is slow", then splice should not > be the thing you optimize for. I think that'd be an acceptable approach, and would at least fix the pure pipe case which I suspect is 99.9% of them, if not more. And yes, it'd mean that we don't need to do the ->confirm() change either, as the pipe is already tainted at that point. I'll respin a v2, post, and send in later this merge window. -- Jens Axboe