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 DB7E1C38142 for ; Fri, 27 Jan 2023 12:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232965AbjA0Mat (ORCPT ); Fri, 27 Jan 2023 07:30:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231834AbjA0Mao (ORCPT ); Fri, 27 Jan 2023 07:30:44 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 105F84EEE; Fri, 27 Jan 2023 04:30:32 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B46311FF3C; Fri, 27 Jan 2023 12:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674822630; h=from:from:reply-to: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=Ko++EeK7T8bysS2hwsZBCuH6k1F9U9HYKOhMMBm7aVY=; b=FGtVF+ifDnNx6Ym7llm38UK0noTKXOhkytSeYRdluDJLLqQIsshL81BuksR1kFhKBdijor B21PwWeGt/tqSlcwQnqrseZzrUZ9lVGdBAj+l89IFPnGZNQCE7BPnIXzh1i1pnWRZr3+r7 MlzsJfWufGeTwBGvEQ8mMt08sdoaPP8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674822630; h=from:from:reply-to: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=Ko++EeK7T8bysS2hwsZBCuH6k1F9U9HYKOhMMBm7aVY=; b=PJzXU1bKZhQ0pDU38zzQdBDzy4U7+UqpT+D3hZZSt5+0OSmJslprdKrGnA/pq6n8caqZ/l WJ8T1oIkdniJBKAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9CDE5138E3; Fri, 27 Jan 2023 12:30:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /AlHJubD02O9AgAAMHmgww (envelope-from ); Fri, 27 Jan 2023 12:30:30 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 24CD6A06B4; Fri, 27 Jan 2023 13:30:30 +0100 (CET) Date: Fri, 27 Jan 2023 13:30:30 +0100 From: Jan Kara To: Al Viro Cc: David Hildenbrand , David Howells , Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jan Kara , Jeff Layton , Jason Gunthorpe , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list from an iterator Message-ID: <20230127123030.qfmgkthuzlxadpkk@quack3> References: <20230126141626.2809643-1-dhowells@redhat.com> <20230126141626.2809643-3-dhowells@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 27-01-23 02:02:31, Al Viro wrote: > On Fri, Jan 27, 2023 at 12:44:08AM +0100, David Hildenbrand wrote: > > On 26.01.23 23:36, Al Viro wrote: > > > On Thu, Jan 26, 2023 at 09:59:36PM +0000, Al Viro wrote: > > > > On Thu, Jan 26, 2023 at 02:16:20PM +0000, David Howells wrote: > > > > > > > > > +/** > > > > > + * iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained > > > > > + * @iter: The iterator > > > > > + * > > > > > + * Examine the iterator and indicate by returning true or false as to how, if > > > > > + * at all, pages extracted from the iterator will be retained by the extraction > > > > > + * function. > > > > > + * > > > > > + * %true indicates that the pages will have a pin placed in them that the > > > > > + * caller must unpin. This is must be done for DMA/async DIO to force fork() > > > > > + * to forcibly copy a page for the child (the parent must retain the original > > > > > + * page). > > > > > + * > > > > > + * %false indicates that no measures are taken and that it's up to the caller > > > > > + * to retain the pages. > > > > > + */ > > > > > +static inline bool iov_iter_extract_will_pin(const struct iov_iter *iter) > > > > > +{ > > > > > + return user_backed_iter(iter); > > > > > +} > > > > > + > > > > > > > > Wait a sec; why would we want a pin for pages we won't be modifying? > > > > A reference - sure, but... > > > > > > After having looked through the earlier iterations of the patchset - > > > sorry, but that won't fly for (at least) vmsplice(). There we can't > > > pin those suckers; > > > > We'll need a way to pass FOLL_LONGTERM to pin_user_pages_fast() to handle > > such long-term pinning as vmsplice() needs. But the release path (unpin) > > will be the same. > > Umm... Are you saying that if the source area contains DAX mmaps, vmsplice() > from it will fail? Yes, that's the plan. Because as you wrote elsewhere, it is otherwise too easy to lock up operations such as truncate(2) on DAX filesystems. Honza -- Jan Kara SUSE Labs, CR