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 51FD1C38142 for ; Fri, 27 Jan 2023 12:38:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C06F36B0071; Fri, 27 Jan 2023 07:38:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB7086B0072; Fri, 27 Jan 2023 07:38:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7EE16B0074; Fri, 27 Jan 2023 07:38:16 -0500 (EST) 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 98FF76B0071 for ; Fri, 27 Jan 2023 07:38:16 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6E147801F2 for ; Fri, 27 Jan 2023 12:38:16 +0000 (UTC) X-FDA: 80400531792.29.65E0E9F Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf16.hostedemail.com (Postfix) with ESMTP id 41CF0180015 for ; Fri, 27 Jan 2023 12:38:14 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jCP327G2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="54sm+x/V"; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674823094; 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=zFTeq0Ir3N0EQQDMB0lGOwLZFNJenO+6frYOzCsuQKs=; b=Dk2pjDiV7IKuQw3MZR/f6Gm+phPib/qctcso37SxpItq8jSieWJYrF7MtgXk4/AX+Joorn 2jOzRsTo1/iOdCQIHCULpc26nuoMPk+ZtdyzaECMuXmHfk65YaVg0fZwGLUCSyYhl0OULq V7ArMJVXYef2saTtZy3A8jvge/j0evA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jCP327G2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="54sm+x/V"; spf=pass (imf16.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674823094; a=rsa-sha256; cv=none; b=V81srMre3Fq1uEcrWFMhISJ8wtMnaOkXzlnoX+DWVaHnkglBhjDkuKs4GBme72pcX3QUI4 Ja1xQ3eXdQbC8N+3IJbo2463Iz2XduFkJY+6tPcWKS3i4oThWWG1VnVOA5a+IcjrO1aN5n qBkD7QYBun6x/fI/GgDHy9BCm/4Nx54= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 191481FEC1; Fri, 27 Jan 2023 12:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674823093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zFTeq0Ir3N0EQQDMB0lGOwLZFNJenO+6frYOzCsuQKs=; b=jCP327G2dfrI2QqS8DkXJJpArCLMvNvuEfU8Ewt1Uhmy0Kb0xGllkzkgC22K2pWQlOmfMD 4kGWg2Rrm7MiaRAoRvF6COqldN+34BS4lxlqdicszAUnAZjf9sKAEKSc704MViQht8nNl9 7mw+T5A3gPoWHWrh48v4ZDRRmM4LJUs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674823093; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zFTeq0Ir3N0EQQDMB0lGOwLZFNJenO+6frYOzCsuQKs=; b=54sm+x/VqYq1b99FVNZ6kbI0fjZp3HiJ+ifLGBybOL1CSDsvofjo0hQHokdR38PbQ6VFNr OCgoKYXa5FSjmMCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 02A961336F; Fri, 27 Jan 2023 12:38:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l3KmALXF02MdBwAAMHmgww (envelope-from ); Fri, 27 Jan 2023 12:38:13 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 77ED2A06B4; Fri, 27 Jan 2023 13:38:12 +0100 (CET) Date: Fri, 27 Jan 2023 13:38:12 +0100 From: Jan Kara To: Al Viro Cc: David Howells , David Hildenbrand , Christoph Hellwig , Matthew Wilcox , Jens Axboe , Jan Kara , 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 Subject: Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list from an iterator Message-ID: <20230127123812.qj2v5mtjllutawcq@quack3> References: <20230126141626.2809643-1-dhowells@redhat.com> <20230126141626.2809643-3-dhowells@redhat.com> <2907150.1674777410@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 41CF0180015 X-Stat-Signature: 88434nb95b51jiaxjygf1i77jqxkj5fr X-HE-Tag: 1674823094-368979 X-HE-Meta: U2FsdGVkX1+G1lLdF6h1ed03eeuigHoRGvsKEETueL/7LSeU6Zf0nEi2eqtrHjc5/QaZBvBZ/wCS69s5HnE4Au6HlEhUjk2RWE+hPt3N37YHK3uRm2EKEZNM0pNoXuI28pqsGOkQZo9YqpRKcuIRPsBI38eHugShduZSpXPPlhWLSm14e33Nqdn255iVh/aOhP5OU1wsubk/3Lbttv/YnfhbMGA/JAi2iDtj31qyslJ3KicU21oroGrwosrJwPBP8LsgycxXUZdaieVr2Sxppe9+F1rS2NRdnoWon5w4MAeSOvrD+BSPsDSxzDn9rjS2ceFi92gihpIBEyXrNPWYZyjEv1gnA2d8xhCU9va5NI2OjFJZIBgMtzonnnRiPqMZffXota7JUCl12QVcZThKc48xAVJfkOxVKfEWlr3V04GEyuHrSiyIFHJ5NxgrFqPvIAy96oWied4tVNS6ikoZg5kUUD00VIM8bQcDL4sb4nb+1wspDBDvjPU/2h5AnIEulPe9SwSTyRv/4gpLYNr8dMTsdgC61Epa/FcETYNG2Z07yAAElS2l/6p8Om0B1AfXDiINXfAF7ZXNiBVVan5elJx1tYd1FL9ZvGaJKlOsPPfcn5N7Xmf3CZe8y3K490m9WPHrzxPM9CNNxIXfn9lqBZLlt6Bb/DW2KOOrPaH4s7rID82D19staREh39OyouRahP025nrk9JrgZf016jzuh5EYeRmRtv6QrrxBkyO14Y4xps9lefN/MeQki5OIiRWXqnN1sPLF9zXcPmi9JhlZ9dkbCzZXbgYDMMu471Jb0YYMNexhlW6MbExOdWu/fidr+Sb+6VHpr+rxBkoTWa5cYwO9WBl2CsZcDobtsJKFaca11NBqNZE272Gh0dAmbymwwqJS6HVb6qaW08gJtRQgDa//C+sF6ADZU3gj5Pxi3L/c3Ve1tsqV08HWi4zTPB3GNcr2RMab52wNKpQ9kp0 nYKR8JL4 VIyRwjTdTRPEX8vbLiSGgBcmB+dzgDnB+DZY5q7A4IVt8I5RS7yPXTDKZeyrOECoOW8ChhDFSZJfFe69DQ+jTcCL002hLdEbZonsJu5PlBIL9IdmJLTVv1tQPTzeOAYe9iWIeKb37IQlzz8oHN87v7X+d098UIY+ulbirchewAWMoq5T/rqpeFYQb8q6JkGJn8dn8GUEIG5bUtx0+mgHz/VbGRQri908deV+zcmTSbSbQKqOlz5C+Ry2y3ul1PPZcxt2CVh1MJQ6NA4isPgrnFYgg+C+C2OOxnWHJsG3hOnIlm19G7zohJmyhR9qBw9vKYzbHcwQJMghoeRzymb6U46TbH00x8e1MoDrWiD0/wBJgWFX18IEne+6ZStSq6kkXPZJJ 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 Fri 27-01-23 00:52:38, Al Viro wrote: > On Thu, Jan 26, 2023 at 11:56:50PM +0000, David Howells wrote: > > Al says that pinning a page (ie. FOLL_PIN) could cause a deadlock if a page is > > vmspliced into a pipe with the pipe holding a pin on it because pinned pages > > are removed from all page tables. Is this actually the case? I can't see > > offhand where in mm/gup.c it does this. > > It doesn't; sorry, really confused memories of what's going on, took a while > to sort them out (FWIW, writeback is where we unmap and check if page is > pinned, while pin_user_pages running into an unmapped page will end up > with handle_mm_fault() (->fault(), actually) try to get the sucker locked > and block on that until the writeback is over). > > Said that, I still think that pinned pages (arbitrary pagecache ones, > at that) ending up in a pipe is a seriously bad idea. It's trivial to > arrange for them to stay that way indefinitely - no priveleges needed, > very few limits, etc. I tend to agree but is there a big difference compared to normal page references? There's no difference for memory usage, pages still can be truncated from the file and disk space reclaimed (this is where DAX has problems...) so standard file operations won't notice. The only difference is that they could stay permanently dirty (we don't know whether the pin owner copies data to or from the page) so it could cause trouble with dirty throttling - and it is really only the throttling itself - page reclaim will have the same troubles with both pins and ordinary page references... Am I missing something? Honza -- Jan Kara SUSE Labs, CR