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,URIBL_BLOCKED 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 43B26C2B9F4 for ; Tue, 22 Jun 2021 18:05:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B185761289 for ; Tue, 22 Jun 2021 18:05:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B185761289 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 93ACB6B005D; Tue, 22 Jun 2021 14:05:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EB1E6B006C; Tue, 22 Jun 2021 14:05:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7654A6B006E; Tue, 22 Jun 2021 14:05:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 3CD8C6B005D for ; Tue, 22 Jun 2021 14:05:52 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7FDCEB282 for ; Tue, 22 Jun 2021 18:05:52 +0000 (UTC) X-FDA: 78282138144.08.E335EC9 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id C1F1A20015CD for ; Tue, 22 Jun 2021 18:05:51 +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=4u1NCyaAJJ8fxeYpU8Gk6l5XhQlmfpxfNSoBL7x9hjU=; b=aJ7Lp27qSS9eU0YVfkFs/6IM+l vOm9pcgy0M/v1BWlSBTFWibCJsqiIsGsH2Ikhl8ZZw18gUkZAT+TqJjWv6rWzGyB9kKoRihWKBFuE YON+ElnCJqFLFsFWHpf16nUklwXeXQaaEIrhxVJXUdCNKfXCf/1t3/V55teOiZMhGZBHaKGv+vZOm G6vMCqeL4lpnDdWmPsTdyeTODow4zPRM28Rvm3cUCNXEm2U+K9RprOiDEr9bK+gpGqNoFmzDYQHCn ne9RPTW7I0nHh3L6B3BftRe5xspS9jEKwG2DCx/j3F2RKbrNTEtwvmCV8uglJSefFA5siLrRs45t9 UeMqdmuw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvkkk-00EasQ-G3; Tue, 22 Jun 2021 18:04:26 +0000 Date: Tue, 22 Jun 2021 19:04:02 +0100 From: Matthew Wilcox To: David Howells Cc: Linus Torvalds , Al Viro , Ted Ts'o , Dave Hansen , Andrew Morton , Linux-MM , Ext4 Developers List , linux-fsdevel , Linux Kernel Mailing List 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> <3231150.1624384533@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3231150.1624384533@warthog.procyon.org.uk> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C1F1A20015CD X-Stat-Signature: etjhnhj79efcebf8teigjczqjfu6z6ao Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aJ7Lp27q; dmarc=none; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1624385151-525700 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 06:55:33PM +0100, David Howells wrote: > Linus Torvalds wrote: > > > End result: doing the fault_in_readable "unnecessarily" at the > > beginning is likely the better optimization. It's basically free when > > it's not necessary, and it avoids an extra fault (and extra > > lock/unlock and retry) when it does end up faulting pages in. > > It may also cause the read in to happen in the background whilst write_begin > is being done. Huh? Last I checked, the fault_in_readable actually read a byte from the page. It has to wait for the read to complete before that can happen.