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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 685E3C6FA86 for ; Thu, 22 Sep 2022 14:38:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09461940009; Thu, 22 Sep 2022 10:38:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 044516B0074; Thu, 22 Sep 2022 10:38:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E015D940009; Thu, 22 Sep 2022 10:38:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D29C56B0073 for ; Thu, 22 Sep 2022 10:38:36 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7D752160806 for ; Thu, 22 Sep 2022 14:38:36 +0000 (UTC) X-FDA: 79939977432.06.04D1637 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf30.hostedemail.com (Postfix) with ESMTP id 286D58000D for ; Thu, 22 Sep 2022 14:38:36 +0000 (UTC) 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663857516; a=rsa-sha256; cv=none; b=aCYQjNXV7Bd0q/PlL7KlIanWVxTSg3+lv3HLc/NOFry79XJZHhowUrX7iFJXtiMLt0t3fJ SgrKZ1yx+FsWKaThwO9VaX3Y2dJSNfR1x3iE5EW4WYYbsXdcdIhcubMeFKnQVRzjdgn0wX 9/9nUkwuAPgj9j1xO25jc4BUb6eNysw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=FfVJkqpE; dmarc=none; spf=none (imf30.hostedemail.com: domain of BATV+ecf30307a2904c53da59+6969+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+ecf30307a2904c53da59+6969+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663857516; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=37n5cEapWKfoXE8Bf6DFAQZkuLu5DdKO4tw3Xp6LEvs=; b=sXi7WP1ysHjCdiymYA5zWmIjX2DoxodioTg1vR/Evc67zJRkTXynbeI1UuOTloardEcLJP v5sVW5z7IDBJhzPWHIRv1fXY6qDhKZVmhylUtfM9ozNk2d7fQLgLNd25ArU0yhMTAa+MpR szhdGUYIggiiCo6hDFHEv1B0zVPk3hk= X-Stat-Signature: 566w1tsbxsemgo1kbgzrzpst678hyr9s X-Rspamd-Queue-Id: 286D58000D Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=FfVJkqpE; dmarc=none; spf=none (imf30.hostedemail.com: domain of BATV+ecf30307a2904c53da59+6969+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+ecf30307a2904c53da59+6969+infradead.org+hch@bombadil.srs.infradead.org X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1663857515-578359 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.