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 30614C38142 for ; Fri, 27 Jan 2023 12:34:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C30AC6B0071; Fri, 27 Jan 2023 07:34:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE19D6B0072; Fri, 27 Jan 2023 07:34:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A82846B0074; Fri, 27 Jan 2023 07:34:58 -0500 (EST) 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 99B2D6B0071 for ; Fri, 27 Jan 2023 07:34:58 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 63D0EAB5D4 for ; Fri, 27 Jan 2023 12:34:58 +0000 (UTC) X-FDA: 80400523476.10.C726E6D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id CE45D1A000F for ; Fri, 27 Jan 2023 12:34:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="aaEhJG/E"; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674822896; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AvUZq9zhTSOpariEqdt1IfiEXwlz3ceeVpAzNf6gzS4=; b=3DPiGNV3himwgRQF1DVku8A1OcMcXQS6rp9tcPRT9hzHho8x5v+rB2gS4fZbvNCbDtpUq6 ZfQpt+1UntK/otng2yvljh7pILrDcqpC6dcVeI1A+4hV6h98wUoRkkKUdmbOBD7YFVYh+E ckAPTIMSquVlez4o1KxGbvcRcGzFDMU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="aaEhJG/E"; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674822896; a=rsa-sha256; cv=none; b=DQv7fQbIa/lG7kLpcaePcPdDcmQD2PI7D3zc7CtSPCGuaWChGe+g2VoKnmEo6MiHvPk74L uXXNE4EN3y1WpVfhproTbewD3Em7cAAaddDTf10+LeiWf4C3a6raEH8YMbPO9lssBntpFv HjdRt1D8yA/iAL0HV4MJju0RhnHfbvw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674822895; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AvUZq9zhTSOpariEqdt1IfiEXwlz3ceeVpAzNf6gzS4=; b=aaEhJG/E/lDHulv7YTxbAVSdw9OWbVoutpFwuQ6inHWPmt5SdkRHiHpZ6179wn4JaOG3JP NXIjISs66b03MkZzq1dbw8UPE2xFAdgYsi9iz9E5OUZ7REjO+5FPxVswPVpEgkF/9wBbMr MRk5x634fdP9+vmSgxKrJhABHk7sDrU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-569-Cx8mvjdLOhupkjIjC_uuCQ-1; Fri, 27 Jan 2023 07:34:53 -0500 X-MC-Unique: Cx8mvjdLOhupkjIjC_uuCQ-1 Received: by mail-wm1-f71.google.com with SMTP id p8-20020a05600c2e8800b003dc3b20747bso735780wmn.1 for ; Fri, 27 Jan 2023 04:34:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AvUZq9zhTSOpariEqdt1IfiEXwlz3ceeVpAzNf6gzS4=; b=g0rPIhvC577LFD8q3Gs80eUXuDP/m0uNEQ3uJGP2Ap/fG6mPLggToe31hAOsrjCibt eMKlBkEVCxwmxn23BHRM+cSsXn729KmwptVZs6JZMzqRJ4ShSBvGLrWMk9E7vkBFOwG8 a56hJjiieDA98EWIg/2RjJNv8Bnn57f5cyD7GHas+4aWpZcFFnduiHQiipjYzIcE8lvm 9pjjpFiB4YBErOhXEy/gkskronccbpjLlR7bj9OIZ2TPf4Co0vhNY0g1r3N+2jg1WDuk kDcDsQAJ9eXq8aChDWUW6FgzeJUetq3GsizBdU2hcWHccW3fyzeTNDe5dtM6uAKki3Xe eH1g== X-Gm-Message-State: AO0yUKUP9ziWulrl1obxEXNiBUnfR5yzG8XQr3tOcBY2FK8D4QVU9IxZ iNYIk4opeAiWTx1Mksftm2RNjIRWwgq2JtxjlESFShjOmnykG/WfTregXh7DocXrqbmi+AtMSuX cxpGWXqDSmAM= X-Received: by 2002:adf:c7c2:0:b0:2bf:d617:6aa0 with SMTP id y2-20020adfc7c2000000b002bfd6176aa0mr1251837wrg.66.1674822892430; Fri, 27 Jan 2023 04:34:52 -0800 (PST) X-Google-Smtp-Source: AK7set8KHfQ+JrxXe4wE8YfNkipOTaYkjMGsfUoE0u82WBLyCb+27hsIT6Rl48f0jOZhn5HYYgkV8g== X-Received: by 2002:adf:c7c2:0:b0:2bf:d617:6aa0 with SMTP id y2-20020adfc7c2000000b002bfd6176aa0mr1251801wrg.66.1674822892038; Fri, 27 Jan 2023 04:34:52 -0800 (PST) Received: from ?IPV6:2003:cb:c705:2600:5c01:dcac:6d6:415? (p200300cbc70526005c01dcac06d60415.dip0.t-ipconnect.de. [2003:cb:c705:2600:5c01:dcac:6d6:415]) by smtp.gmail.com with ESMTPSA id a17-20020a5d53d1000000b0024cb961b6aesm3841439wrw.104.2023.01.27.04.34.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Jan 2023 04:34:51 -0800 (PST) Message-ID: Date: Fri, 27 Jan 2023 13:34:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list from an iterator To: Jan Kara , Al Viro Cc: David Howells , Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jeff Layton , 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 References: <20230126141626.2809643-1-dhowells@redhat.com> <20230126141626.2809643-3-dhowells@redhat.com> <20230127123030.qfmgkthuzlxadpkk@quack3> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230127123030.qfmgkthuzlxadpkk@quack3> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: CE45D1A000F X-Stat-Signature: 7zx66xtjg6f31n4ur47jroakg1w8t8ek X-Rspam-User: X-Rspamd-Server: rspam08 X-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Gez+lkHU03uXmCzssVcmlmzypkfKTKhbA9YkpfLyV3gyX3l+uDSgo1iHyhVqCnGZc2cIVEgHNKl5lDFbfzI7iixFOJ6opge25YuGm831IGPe9hopa5mlzuHwdWwAdW6zFPFPgYBS/f7LFIHi0lUCOPQxazx0+Ul3a/xCJ5Zz6vE1eKEc7wb4iBwIUYaZUssp1NU2ygiDW307vdY7DJuPGTVEDFhXJ+TX5/RjkuM55/KMQ7a47XaD1mcQsqgL2s83vVeR/TPO+TU+R81AQk0lGlih9kjgSveDCaIPPGF+xuEoKhtcEGWDso/nC350iHXngzRUhePQGrfAAzKDY490o+BHBvo0+Sr+edxIo2USAdj0LScbaCHYRn3QXq7+tQRhuMbBRSQrk+VmpJhgcIwgZ/gdObYpsV2XkFNLaoHuQoMCFLsQa8n3KOkDavj/30oLsF/2M= 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 27.01.23 13:30, Jan Kara wrote: > On Fri 27-01-23 02:02:31, Al Viro wrote: >> On Fri, Jan 27, 2023 at 12:44:08AM +0100, David Hildenbrand wrote: >>> On 26.01.23 23:36, Al Viro wrote: >>>> 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; >>> >>> We'll need a way to pass FOLL_LONGTERM to pin_user_pages_fast() to handle >>> such long-term pinning as vmsplice() needs. But the release path (unpin) >>> will be the same. >> >> Umm... Are you saying that if the source area contains DAX mmaps, vmsplice() >> from it will fail? > > Yes, that's the plan. Because as you wrote elsewhere, it is otherwise too easy > to lock up operations such as truncate(2) on DAX filesystems. Right, it's then the same behavior as we already have for other FOLL_LONGTERM users, such as RDMA or io_uring. ... if we're afraid of breaking existing setups we could add some kind of fallback to copy to a buffer like ordinary pipe writes. -- Thanks, David / dhildenb