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 E432CC636CC for ; Sat, 11 Feb 2023 06:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229454AbjBKGSW (ORCPT ); Sat, 11 Feb 2023 01:18:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjBKGSV (ORCPT ); Sat, 11 Feb 2023 01:18:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CCB7072E for ; Fri, 10 Feb 2023 22:17:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676096252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+CTwGPJ6Nc46AzE4LIyhb9Ckm0HjZ8PmHDXQrmNlV6c=; b=f6xonc4uEiwf8YwvcYZGw4O2/lHFuKTwxWepAegY5KuYMk0X7dCxPA2mtTUswo5NgnqWs1 Lj4PC34FsIfelAgIga22t5VZ/ivmBRAoG62oEyE0LzaxkdZ7cJj7N7QmkD+k9CxDcx28UT /19w0cECZ7/SsnqKOEmkL2kHoDRtk2I= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-mXpfP7K7MgOq65-LwG78LQ-1; Sat, 11 Feb 2023 01:17:31 -0500 X-MC-Unique: mXpfP7K7MgOq65-LwG78LQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3B5FE29AA3B7; Sat, 11 Feb 2023 06:17:30 +0000 (UTC) Received: from T590 (ovpn-8-18.pek2.redhat.com [10.72.8.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F3DD492C3F; Sat, 11 Feb 2023 06:17:22 +0000 (UTC) Date: Sat, 11 Feb 2023 14:17:18 +0800 From: Ming Lei To: Linus Torvalds Cc: Jens Axboe , 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 , ming.lei@redhat.com Subject: Re: copy on write for splice() from file to pipe? Message-ID: References: <1dd85095-c18c-ed3e-38b7-02f4d13d9bd6@kernel.dk> <7a2e5b7f-c213-09ff-ef35-d6c2967b31a7@kernel.dk> <2bb12591-9d24-6b26-178f-05e939bf3251@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Sat, Feb 11, 2023 at 11:18:38AM +0800, Ming Lei wrote: > On Fri, Feb 10, 2023 at 02:08:35PM -0800, Linus Torvalds wrote: > > On Fri, Feb 10, 2023 at 1:51 PM Jens Axboe wrote: > > > > > > Speaking of splice/io_uring, Ming posted this today: > > > > > > https://lore.kernel.org/io-uring/20230210153212.733006-1-ming.lei@redhat.com/ > > > > Ugh. Some of that is really ugly. Both 'ignore_sig' and > > 'ack_page_consuming' just look wrong. Pure random special cases. > > > > And that 'ignore_sig' is particularly ugly, since the only thing that > > sets it also sets SPLICE_F_NONBLOCK. > > > > And the *only* thing that actually then checks that field is > > 'splice_from_pipe_next()', where there are exactly two > > signal_pending() checks that it adds to, and > > > > (a) the first one is to protect from endless loops > > > > (b) the second one is irrelevant when SPLICE_F_NONBLOCK is set > > > > So honestly, just NAK on that series. > > > > I think that instead of 'ignore_sig' (which shouldn't exist), that > > first 'signal_pending()' check in splice_from_pipe_next() should just > > be changed into a 'fatal_signal_pending()'. > > Good point, here the signal is often from task_work_add() called by > io_uring. > > > > > But that 'ack_page_consuming' thing looks even more disgusting, and > > since I'm not sure why it even exists, I don't know what it's doing > > wrong. > > The motivation is for confirming that if the produced buffer can be used > for READ or WRITE. Another way could be to add PIPE_BUF_FLAG_MAY_READ[WRITE]. BTW, I meant the added flags are source/sink private flags, which are not used by generic pipe/splice code, just used by the actual source and sink subsystem. thanks, Ming