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 7FBFDC61D97 for ; Thu, 26 Jan 2023 22:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231753AbjAZWP1 (ORCPT ); Thu, 26 Jan 2023 17:15:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbjAZWPY (ORCPT ); Thu, 26 Jan 2023 17:15:24 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B591D42DD5; Thu, 26 Jan 2023 14:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jd/5WIrcHcZzAYHPugOmZ9o+ttQGJRTdajMdq6eexVQ=; b=poCgIh0b2tUBO/p9HbXoT9N6pJ zx+i2ZI4FFh50Ucj8MSNsEEJO+ir8dAn3D9mfCbSJ9/hghKTWm+vntEsb7hSTR4ZC+k59zRY/3bHA Jvs3efe71mZtbyvytGsKHk4Gah85oxCcnzMlmy2a0Vipjz/0LXhXLHFxEP0jLg5Pj7bwnutTI+Bsr klni0UFu3h603jdMcn+xvTdmOG4Y9x7/NZJJ0FK+42PBt+LcjHCqy8nchhFPYVNi+6PFTrbkaG77u zkRxfm+dNHWlGVSfeunz2AczKYTDikGJPapL9hwGHHk6SzhXMnGiRPsQHaUhB/rYixXLWyNBGIa01 aKIUcTcQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pLAWX-004KFl-0g; Thu, 26 Jan 2023 22:15:13 +0000 Date: Thu, 26 Jan 2023 22:15:13 +0000 From: Al Viro To: David Hildenbrand Cc: David Howells , Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jan Kara , Jeff Layton , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , John Hubbard , linux-mm@kvack.org Subject: Re: [PATCH v7 2/8] iov_iter: Add a function to extract a page list from an iterator Message-ID: References: <7bbcccc9-6ebf-ffab-7425-2a12f217ba15@redhat.com> <246ba813-698b-8696-7f4d-400034a3380b@redhat.com> <20230120175556.3556978-1-dhowells@redhat.com> <20230120175556.3556978-3-dhowells@redhat.com> <3814749.1674474663@warthog.procyon.org.uk> <3903251.1674479992@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 23, 2023 at 02:24:13PM +0100, David Hildenbrand wrote: > On 23.01.23 14:19, David Howells wrote: > > David Hildenbrand wrote: > > > > > Switching from FOLL_GET to FOLL_PIN was in the works by John H. Not sure what > > > the status is. Interestingly, Documentation/core-api/pin_user_pages.rst > > > already documents that "CASE 1: Direct IO (DIO)" uses FOLL_PIN ... which does, > > > unfortunately, no reflect reality yet. > > > > Yeah - I just came across that. > > > > Should iov_iter.c then switch entirely to using pin_user_pages(), rather than > > get_user_pages()? In which case my patches only need keep track of > > pinned/not-pinned and never "got". > > That would be the ideal case: whenever intending to access page content, use > FOLL_PIN instead of FOLL_GET. > > The issue that John was trying to sort out was that there are plenty of > callsites that do a simple put_page() instead of calling unpin_user_page(). > IIRC, handling that correctly in existing code -- what was pinned must be > released via unpin_user_page() -- was the biggest workitem. > > Not sure how that relates to your work here (that's why I was asking): if > you could avoid FOLL_GET, that would be great :) Take a good look at iter_to_pipe(). It does *not* need to pin anything (we have an ITER_SOURCE there); with this approach it will. And it will stuff those pinned references into a pipe, where they can sit indefinitely. IOW, I don't believe it's a usable approach.