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.8 required=3.0 tests=BAYES_00, 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 66D70C2B9F4 for ; Tue, 22 Jun 2021 15:36:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1AB8E611BF for ; Tue, 22 Jun 2021 15:36:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AB8E611BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 03F036B006C; Tue, 22 Jun 2021 11:36:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F16656B0070; Tue, 22 Jun 2021 11:36:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5A6D6B0071; Tue, 22 Jun 2021 11:36:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 8CC096B006C for ; Tue, 22 Jun 2021 11:36:29 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C18D4144E8 for ; Tue, 22 Jun 2021 15:36:29 +0000 (UTC) X-FDA: 78281761698.39.31B8FF2 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [142.44.231.140]) by imf21.hostedemail.com (Postfix) with ESMTP id 746D5E002CC5 for ; Tue, 22 Jun 2021 15:36:29 +0000 (UTC) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lviRq-00BENn-NA; Tue, 22 Jun 2021 15:36:22 +0000 Date: Tue, 22 Jun 2021 15:36:22 +0000 From: Al Viro To: David Howells Cc: torvalds@linux-foundation.org, Ted Ts'o , Dave Hansen , Andrew Morton , willy@infradead.org, 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: Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=none; spf=none (imf21.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 142.44.231.140) smtp.mailfrom=viro@ftp.linux.org.uk X-Stat-Signature: o3w4tnopqo43fnqe7qmug6pwgek9qzau X-Rspamd-Queue-Id: 746D5E002CC5 X-Rspamd-Server: rspam06 X-HE-Tag: 1624376189-571041 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 03:27:43PM +0000, Al Viro wrote: > 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. > > Yes, it is. So what? We'll just retry. You *can't* take faults while holding > some pages locked; not without shitloads of deadlocks. Note that the revert you propose is going to do fault-in anyway; we really can't avoid it. The only thing it does is optimistically trying without that the first time around, which is going to be an overall loss exactly in "slow write_begin" case. If source pages are absent, you'll get copyin fail; iov_iter_copy_from_user_atomic() (or its replacement) is disabling pagefaults itself.