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 7B607C6FA82 for ; Thu, 22 Sep 2022 14:37:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17EC5940008; Thu, 22 Sep 2022 10:37:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1082A6B0074; Thu, 22 Sep 2022 10:37:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F119B940008; Thu, 22 Sep 2022 10:37:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DF7E06B0073 for ; Thu, 22 Sep 2022 10:37:26 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BB7BC14152B for ; Thu, 22 Sep 2022 14:37:26 +0000 (UTC) X-FDA: 79939974492.08.729DCC9 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) by imf30.hostedemail.com (Postfix) with ESMTP id 3784A8000E for ; Thu, 22 Sep 2022 14:37:25 +0000 (UTC) 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=PnZrxUy9P5w7rj/UPAer5HPpUVVqgQM8T4IHUrrMARE=; b=O7Uf24ePDbCW3jV0DTEkbSSKYV bNiC//IcuLghSDMf1uFDPey4RLVLwwCExs21sumSsTXYpYORgU/MicluPYCOVTW1mvwXGxbHoUoyb hvFqRT9d5TfP8fIU6zKHuYi6PXuDzliIxGLb2IQfA3s0ynJtZBb8Jv9VIne13C04DE5XVQb9h/52c ya9BAq7upUONaIemf1jZZnpjTXDvLIIgYS48eqPW7VgIiGjewfoZPXY6TLKJwcighU/a5igF7Im+I Ike3xVTI4+UN4EM7aNEe7DRcPuEO+kmLbq/9t/mfrlniEimUkLt7/v7drU6tlGY0lvzfihrTSJZtA UNsO2dog==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1obNJs-002RKQ-1W; Thu, 22 Sep 2022 14:36:52 +0000 Date: Thu, 22 Sep 2022 15:36:52 +0100 From: Al Viro To: Christoph Hellwig Cc: Jan Kara , 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: <20220831041843.973026-1-jhubbard@nvidia.com> <20220831041843.973026-5-jhubbard@nvidia.com> <103fe662-3dc8-35cb-1a68-dda8af95c518@nvidia.com> <20220906102106.q23ovgyjyrsnbhkp@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663857445; a=rsa-sha256; cv=none; b=EdlC6lSwm9DgEThIlu81zHhqpvnnIv2LUkwQgH+ltf990qSCjtgTYvH03I3pQPTYNXa/+m idOXktgBaijtcrZe5CGdMgLZSrrrUq/ZEsZKmfL0ATyWQD2ZMObS9m2+Autmte0SWmYvuP ouH5zC0iBn+Fm43WkVqEB4UANCMgaXk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=O7Uf24eP; spf=none (imf30.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663857445; h=from:from:sender: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=PnZrxUy9P5w7rj/UPAer5HPpUVVqgQM8T4IHUrrMARE=; b=qd/L6WTOX2Caz3DfhSQ0o7qvBgK5+i5EyTdm2pOqM3NvuxoJoPsap5vDB74/gg2h4PLXhe 2IvloNzl2mu/+RscQ2ISomJ0J7/YqyP8uuw5aSIFpyZzFU1kDd7e6WDChvARS+8z45MxlM Vgwu7zgF2C+Vn/1eLsZRatBgdiuAasw= Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=O7Uf24eP; spf=none (imf30.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk X-Rspam-User: X-Stat-Signature: 43k8mtcbm9kz433beaknsy4d1p88t5hi X-Rspamd-Queue-Id: 3784A8000E X-Rspamd-Server: rspam02 X-HE-Tag: 1663857445-611832 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 07:31:36AM -0700, Christoph Hellwig wrote: > On Wed, Sep 14, 2022 at 04:51:17AM +0100, Al Viro wrote: > > Unless I'm misreading Jan, the question is whether they should get or > > pin. > > And I think the answer is: inside ->read_iter or ->write_iter they > should neither get or pin. The callers of it need to pin the pages > if they are pagecache pages that can potentially be written to through > shared mappings, else a get would be enough. But the method instance > should not have to care and just be able to rely on the caller making > sure they do not go away. The interesting part, AFAICS, is where do we _unpin_ them and how do we keep track which pages (obtained from iov_iter_get_pages et.al.) need to be unpinned. > > I'm really tempted to slap > > if (WARN_ON(i->data_source)) > > return 0; > > into copy_to_iter() et.al., along with its opposite for copy_from_iter(). > > Ys, I think that would be useful. And we could use something more > descriptive than READ/WRITE to start with. See #work.iov_iter; done, but it took a bit of fixing the places that create iov_iter instances.