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 AE90DC54EAA for ; Thu, 26 Jan 2023 22:36:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E4546B0071; Thu, 26 Jan 2023 17:36:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2948B6B0072; Thu, 26 Jan 2023 17:36:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15BFE8E0001; Thu, 26 Jan 2023 17:36:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 071A86B0071 for ; Thu, 26 Jan 2023 17:36:43 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C8AA2AB679 for ; Thu, 26 Jan 2023 22:36:42 +0000 (UTC) X-FDA: 80398411044.29.CC54A93 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) by imf11.hostedemail.com (Postfix) with ESMTP id 2419140003 for ; Thu, 26 Jan 2023 22:36:40 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=V9sk87fG; spf=none (imf11.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=1674772601; 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=0/PkAfHsLqcevA2izl1MQ6yBtz3dbdjOiMUhMCM3P48=; b=EshW4tAWiGDpGMrWdD5KnmKBZF3ttGpanxO23oK3FokoEiqocJwFTC+dNACQFadTclO86i FUgIjbC1rVQttKpYlbP4HnRfGmCVgvcXUihCSVFyfZTcgxYkf13iXEugfmw212hMknF9og RHA5APmnszHN00qsclXr1NfBGBqPwzc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=V9sk87fG; spf=none (imf11.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674772601; a=rsa-sha256; cv=none; b=RTm/cKqJkdVu3FbGUMPeuS4jbJ7TPFqO8KuwUSqMLKIE88g0zhDrfKBFjEuPkUxyYvldFm LZc+AdAWiXB/TEu5qGEEBVXxHYUCYywSBBwU5cJkNU2mRFKs5F5qRzAJVfRWIoOWXOOeJx ChK6SFO6/KlQrn4GBIMRlNLhbMJ5Bew= 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=0/PkAfHsLqcevA2izl1MQ6yBtz3dbdjOiMUhMCM3P48=; b=V9sk87fGCZgxAM4m6/tVZdmHP9 DNf7/qXxvHeNlH1BotGKUtjA989UVR/MSI4ldUOlWzZrWkoHM9PVK8yNF+f4BhUZ9tgmPBCEznQEk q7VFjPtTHz70AloAUNICbRRLcYpfqogS2zF3PpQ9SnH6g8dPDfMddAj8uHxPT8LzNVVoAKKAJQp7c VCLl36gqXBDXGDuMzaFt/B4JjH+NU5EqrFlVJ+enfQyfYgE6mm+4qXo3UreBXm/aknlifmQO8AumI t/9+HOeqgBJonNUVdusQ0r0dF+Fxu1oDGQB+qIPNhUOWDCa6knauSHoX57hAte3iwQqn8m5ewL2ae GE6Bq7wg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pLAr7-004KSd-2b; Thu, 26 Jan 2023 22:36:29 +0000 Date: Thu, 26 Jan 2023 22:36:29 +0000 From: Al Viro To: David Howells Cc: Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list from an iterator Message-ID: References: <20230126141626.2809643-1-dhowells@redhat.com> <20230126141626.2809643-3-dhowells@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2419140003 X-Rspam-User: X-Stat-Signature: ae9pn79skpgkm9cg189pjsnb8utw3on8 X-HE-Tag: 1674772600-425392 X-HE-Meta: U2FsdGVkX18QXioi7zD4xYFZ+zWz9CLWXKzUplhx2/iQYYU8yvzKKPV79EFCzuI8iBGt1fF83iaW8RV6LFfWnuc0xplOfXSo8qhON3fgtB9P21HQr4ljTueTaqqYtnZt2firu+L7+e+rE1zraZWdlMaE2gV7KEsaqdyCl4dcUjhKjd906BlkkqmagYcQvv3p7Q40N1PSrzh6e2dqEoeFriPHJRhto0r5SBAbOFcHu5f/lnO1Seud5AXhy3ui7oBV2jEY8xZ+R233ZU4oxZpjCDD8BeVyuuYqzPJBEmBuZVK08p97Ay7wobMYI767hxlQpTb0MK3M3QK5qxyFmw1J/D7GX0buB8465s+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yNX6E45zCVaiCzlBVHrqBbux6S636fg9 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001213, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 26, 2023 at 09:59:36PM +0000, Al Viro wrote: > On Thu, Jan 26, 2023 at 02:16:20PM +0000, David Howells wrote: > > > +/** > > + * iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained > > + * @iter: The iterator > > + * > > + * Examine the iterator and indicate by returning true or false as to how, if > > + * at all, pages extracted from the iterator will be retained by the extraction > > + * function. > > + * > > + * %true indicates that the pages will have a pin placed in them that the > > + * caller must unpin. This is must be done for DMA/async DIO to force fork() > > + * to forcibly copy a page for the child (the parent must retain the original > > + * page). > > + * > > + * %false indicates that no measures are taken and that it's up to the caller > > + * to retain the pages. > > + */ > > +static inline bool iov_iter_extract_will_pin(const struct iov_iter *iter) > > +{ > > + return user_backed_iter(iter); > > +} > > + > > Wait a sec; why would we want a pin for pages we won't be modifying? > A reference - sure, but... After having looked through the earlier iterations of the patchset - sorry, but that won't fly for (at least) vmsplice(). There we can't pin those suckers; thankfully, we don't need to - they are used only for fetches, so FOLL_GET is sufficient. With your "we'll just pin them, source or destination" you won't be able to convert at least that call of iov_iter_get_pages2(). And there might be other similar cases; I won't swear there's more, but ISTR running into more than one of the "pin won't be OK here, but fortunately it's a data source" places.