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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EABADC2B9F4 for ; Tue, 22 Jun 2021 15:33:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E4A3611BF for ; Tue, 22 Jun 2021 15:33:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E4A3611BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 54BF76B0070; Tue, 22 Jun 2021 11:33:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 523056B0074; Tue, 22 Jun 2021 11:33:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 413276B0078; Tue, 22 Jun 2021 11:33:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 0E1BE6B0070 for ; Tue, 22 Jun 2021 11:33:24 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3FD14181AEF1E for ; Tue, 22 Jun 2021 15:33:24 +0000 (UTC) X-FDA: 78281753928.05.60A89A3 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 63D7B40003B6 for ; Tue, 22 Jun 2021 15:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=onXjNZqYJvcXEs5IHU9oGds+e0Y699nhJ9IN46Qq5mk=; b=PCnfHk7hpZ8eK7iPoYxSOSuj6G 1tUFbwnesmnCZZYpqC+8zpn7nVezeIhTJkGu3HAru4xuQ2ITGOzB8rB2u+pBNY4mmQw34951UjgFH mkqMzGLYQtulSDgUlSbcIfhLz3aB29WXpvSyL2e7scCCUjelbAgXrGW4GZGgsqBLTiPRK7GW8ArFm FRbOPhnArtDCAec9CaxrQYaa+7NpPDmEHZMyjUOpucSyIEY9haZEuWXLnPWsLPjGsnG/M+jWtHpWI Z2RI2N1TZCBEL12bboLdGP76RpuzQ9y47vG1zzN27I7NcDTcMgImIBnzLe/6veLF3VFjals1bMlsO 1rTQ37uA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lviO7-00ERke-6n; Tue, 22 Jun 2021 15:32:37 +0000 Date: Tue, 22 Jun 2021 16:32:31 +0100 From: Matthew Wilcox To: David Howells Cc: torvalds@linux-foundation.org, Ted Ts'o , Dave Hansen , Andrew Morton , viro@zeniv.linux.org.uk, linux-mm@kvack.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Do we need to unrevert "fs: do not prefault sys_write() user buffer pages"? Message-ID: References: <3221175.1624375240@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3221175.1624375240@warthog.procyon.org.uk> Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PCnfHk7h; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam02 X-Stat-Signature: jtsbxnw7dr6u8g5owewjbge7hrp4ju3p X-Rspamd-Queue-Id: 63D7B40003B6 X-HE-Tag: 1624376003-139140 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 Tue, Jun 22, 2021 at 04:20:40PM +0100, David Howells wrote: > and wondering if the iov_iter_fault_in_readable() is actually effective. Yes, > it can make sure that the page we're intending to modify is dragged into the > pagecache and marked uptodate so that it can be read from, but is it possible > for the page to then get reclaimed before we get to > iov_iter_copy_from_user_atomic()? a_ops->write_begin() could potentially take > a long time, say if it has to go and get a lock/lease from a server. It's certainly possible, but unlikely. The page is going to go to the head of the active queue, and so we'll have to burn our way through the entire inactive and then active queue in order to bump this page out of memory. > Also, I've been thinking about Willy's folio/THP stuff that allows bunches of > pages to be glued together into single objects for efficiency. This is > problematic with the above code because the faultahead is limited to a maximum > of PAGE_SIZE, but we might be wanting to modify a larger object than that. Just to be clear, it's not _currently_ a problem for the folio patchset. Multi-page folios are only created during readahead. Unless there's a read error during readahead, a folio found during write() will either be freshly created and order-0, or it'll be multi-order and uptodate. I would like to create larger folios during write() eventually, but I'm choosing to not burden the folio patchset with that enhancement yet. It has enough performance improvement to not need that yet.