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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 102B9C2B9F4 for ; Tue, 22 Jun 2021 18:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE33161002 for ; Tue, 22 Jun 2021 18:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232799AbhFVSLb (ORCPT ); Tue, 22 Jun 2021 14:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232630AbhFVSLQ (ORCPT ); Tue, 22 Jun 2021 14:11:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46A45C06114F; Tue, 22 Jun 2021 11:06:10 -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=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> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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.