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 2D9D1C54EE9 for ; Thu, 22 Sep 2022 14:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232048AbiIVOjx (ORCPT ); Thu, 22 Sep 2022 10:39:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231852AbiIVOje (ORCPT ); Thu, 22 Sep 2022 10:39:34 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D94FE057; Thu, 22 Sep 2022 07:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=37n5cEapWKfoXE8Bf6DFAQZkuLu5DdKO4tw3Xp6LEvs=; b=FfVJkqpELYi6tUWlw6XBYIh7FT cWh9uVle8XDuwjuWYQR7SN1CwxKbgC8IOozJlvUjB50JnIniobV6Y/7H/n7GaTcM6W7nmT+kfNmMM pcKqI6xgwg2aRQ2/Sk7jtmn37eOCC9uFFrvCI/c7TqnVNK1m6Bnuy/yIhpXHUwfE6om6kLOuDMbPm VotYmqPnWO7ReMpJ/3mnqQBu/UUSBIb8Zn1S6C0aStVqoEOYwN3ZF+IbMHvZme0ZoGXKJ7gLGOfC+ PGGHJ8xKRfNzS1osbImT9twYd9U9wT7xq4uFsoCA3AKCTZ4/JpGwzpgTCLrYK2iPGctspqRqUxttn ppGH0Oxw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1obNLN-00G6BV-1d; Thu, 22 Sep 2022 14:38:25 +0000 Date: Thu, 22 Sep 2022 07:38:25 -0700 From: Christoph Hellwig To: Al Viro Cc: Jan Kara , Christoph Hellwig , John Hubbard , Andrew Morton , Jens Axboe , Miklos Szeredi , "Darrick J . Wong" , Trond Myklebust , Anna Schumaker , David Hildenbrand , Logan Gunthorpe , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, LKML Subject: Re: [PATCH v2 4/7] iov_iter: new iov_iter_pin_pages*() routines Message-ID: References: <103fe662-3dc8-35cb-1a68-dda8af95c518@nvidia.com> <20220906102106.q23ovgyjyrsnbhkp@quack3> <20220914145233.cyeljaku4egeu4x2@quack3> <20220915081625.6a72nza6yq4l5etp@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Thu, Sep 22, 2022 at 03:22:48AM +0100, Al Viro wrote: > What I'd like to have is the understanding of the places where we drop > the references acquired by iov_iter_get_pages(). How do we decide > whether to unpin? Add a iov_iter_unpin_pages that does the right thing based on the type. (block will need a modified copy of it as it doesn't keep the pages array around, but logic will be the same). > E.g. pipe_buffer carries a reference to page and no > way to tell whether it's a pinned one; results of iov_iter_get_pages() > on ITER_IOVEC *can* end up there, but thankfully only from data-source > (== WRITE, aka. ITER_SOURCE) iov_iter. So for those we don't care. > Then there's nfs_request; AFAICS, we do need to pin the references in > those if they are coming from nfs_direct_read_schedule_iovec(), but > not if they come from readpage_async_filler(). How do we deal with > coalescence, etc.? It's been a long time since I really looked at > that code... Christoph, could you give any comments on that one? I think the above should work, but I'll need to look at the NFS code in more detail to be sure.