Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp894681rwb; Thu, 22 Sep 2022 07:40:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C6y9z+NLWStLG9+JSIws+9y8WSBcyYc2dcL4BVByWU8+IiSYrqpfDPlue1SKLN6zKkdEI X-Received: by 2002:a17:902:c94a:b0:177:fd5d:d361 with SMTP id i10-20020a170902c94a00b00177fd5dd361mr3541745pla.139.1663857655812; Thu, 22 Sep 2022 07:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663857655; cv=none; d=google.com; s=arc-20160816; b=XaVt/MVGrRc8c+rfsphPUNXUaoFxW+mV6mInjGgb+qDdPApNOzgavI5ehaLfwGxC0K HJw5GvLMYBHNd+/8VhkT4orF80kFzgocyia1eXAAfY4O59nNhL9CETOhEmPv3HwOAVC+ c5eBxLbCU8czSZxpPEzgLEroxoDb/FOEQqeQ2O83lbwbkE028aFeSsZDmCzYtld/1SZW +B+hhws77DjqGn45d7felKlY3cv4Z3OfBEpcGg50jgw745oPO1bPKQWsYwNLXfApuWqG hiR7hgCxEtk8VGzxb7vunh5g+y1qzhatYofcEt505Yb3GqkU2zuC4eTa+W4kqCvnf//a MUTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=37n5cEapWKfoXE8Bf6DFAQZkuLu5DdKO4tw3Xp6LEvs=; b=G+kgSKt2G+kxuDYXFLUIonsT9ZUseSWXHjhwfUt1K6aHySOrNY211LRuzfUYQFUdqO g/nO7PxYYbVQsbJCv0nlbECcD/k5/3l6GzBi0X+VYT5AcWgj7JPZ5vTFzwpM5EnfB3X5 G0vmlDpH4wrUes3B5w2UtwWti7xmt1+tIriQrmuVBS/bNGpfSElKxmfwipOgSrhQQ+oh SyW0m7EvOiQhPXRvFfQGELe6LYDWr+Q/7Z7JSaT+cCWGiASF+iYV5owdhJVNJ9D708sp tOa9WYsqC20w6sagHCn/QxUWnLG4Y8XK5ECg82RqQuWlv/620iiAW7/hseBsuRNcxNOW wMyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FfVJkqpE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 a16-20020a656550000000b0042b4a196e65si5955869pgw.470.2022.09.22.07.40.40; Thu, 22 Sep 2022 07:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@infradead.org header.s=bombadil.20210309 header.b=FfVJkqpE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231411AbiIVOjx (ORCPT + 99 others); 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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-nfs@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.