Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4901209pxj; Tue, 22 Jun 2021 10:26:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD0irE+Hqefaa/BqX3X7fzlp6hTIvJ8PTAZ9/6YcScapTv26QvhLGDEr6xnW0oVlsHXlCk X-Received: by 2002:a02:230d:: with SMTP id u13mr4910610jau.138.1624382809803; Tue, 22 Jun 2021 10:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624382809; cv=none; d=google.com; s=arc-20160816; b=IYAqAWAzvFb62+CuSkmwGdjNCToE6z/iHJ1J8P8oaspsJGMwtiDPE47FN9AJkw2h+C dh1JHyB17YY0cShulHkzkytWMq9pr17716rTp2Snx3HsZKnP7wjuluSytKlmaXcMcCRJ MlugO753J/eLsK9IkIPWNfSoK528ukWvs5vquh3AnOAmpu4gWAIFdhJki7hpETax5vIy H4G1ysvaU/daNfBpGt4WqskkHU+UhgBdTfhBdZTR63TMbuKXvnNK5KfhKuAip5kyXwVX 5TrlmW+3hujYiNwNs5aMUOhF7oHJMQLY4eXw95I6dEXx+9VYj9kb381XOI2iju6NdROw AZiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mOJMY6UOYq7EaC2SDC9v+zeUo0FEEd2ZM34anZJPrG8=; b=HwYWep50qEuYNQMesaY5Jr457Qk2sDDtDYyWidOQEpyokc6U3I700a/Z/IvLrWbM+m i395NRZoubYBe3GMDTZnjq8m/AIRkY6i5jZk4tB7oSrP4b7W3Dc0J1zaj0pss5M57CKy iaujy1/R4IaR2v0W0Bllma1l2zROp4qyJ9OZs1j5cSvmYBCssihY+zV5evyVj3DnJhqA 7Jk96GW7R2EsDkcikBFYOzefaPq9D0ARr7eCume+dptKyPBB7ICAyzOUumNRTY/Pb4Am jNGMmCW7yYEOAGmVeqW+7zQZS0kYPud62pD5ySAZbub7lzaJ82gcHwJlev3my8zA6GcI +sAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RDSUY3nJ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si11605364ion.22.2021.06.22.10.26.32; Tue, 22 Jun 2021 10:26:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RDSUY3nJ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbhFVR2q (ORCPT + 99 others); Tue, 22 Jun 2021 13:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbhFVR2q (ORCPT ); Tue, 22 Jun 2021 13:28:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E98C061574; Tue, 22 Jun 2021 10:26:30 -0700 (PDT) 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=mOJMY6UOYq7EaC2SDC9v+zeUo0FEEd2ZM34anZJPrG8=; b=RDSUY3nJuJPGNXnzMGU4Nm5OFG knOmUgsCxWwKh/8EEHQUy9vtATVzVa8ve5UAvHrphjagiV5sMXQBT4oiOpM56T/AXJAqcpSJwD5A/ TaSvPzxDSTgo2NBa69kr1+HwavpGgZan5lVpRGf2qGKgLXfHgKq1d7I2IF1Na7rdx8tmP+lloSlRw ZumFsdUMykOmBOGfn0HqHv968m2YdfHs11FnwSsPriLaEBFmXg4B6I6KDyaYxrfl7V5IY3outGNQx WvWuOuZermop/gA5DF6UoLvqJXJ+efg0szmPWASoPPyX3nHPhyYdKQLnV+DvqhGYli8bhEQQGWXTq S6KI9I5Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvk9t-00EY8S-Ia; Tue, 22 Jun 2021 17:26:00 +0000 Date: Tue, 22 Jun 2021 18:25:57 +0100 From: Matthew Wilcox To: Al Viro Cc: David Howells , torvalds@linux-foundation.org, Ted Ts'o , Dave Hansen , Andrew Morton , 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: Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jun 22, 2021 at 03:36:22PM +0000, Al Viro wrote: > 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. Let's not overstate the case. I think for the vast majority of write() calls, the data being written has recently been accessed. So this userspace access is unnecessary. From the commentary around commits 00a3d660cbac and 998ef75ddb57, it seems that Dave had a CPU which was particularly inefficient at accessing userspace. I assume Intel have fixed that by now and the extra load is in the noise. But maybe enough CPU errata have accumulated that it's slow again?