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=-7.3 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,USER_AGENT_SANE_1 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 A4D08C433B4 for ; Wed, 7 Apr 2021 02:53:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3D29761359 for ; Wed, 7 Apr 2021 02:53:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D29761359 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=lespinasse.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CBABE6B0073; Tue, 6 Apr 2021 22:53:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C42E56B007E; Tue, 6 Apr 2021 22:53:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE0FA6B0081; Tue, 6 Apr 2021 22:53:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 921D66B0073 for ; Tue, 6 Apr 2021 22:53:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3E8F66D97 for ; Wed, 7 Apr 2021 02:53:28 +0000 (UTC) X-FDA: 78004050096.17.1832370 Received: from server.lespinasse.org (server.lespinasse.org [63.205.204.226]) by imf26.hostedemail.com (Postfix) with ESMTP id 664F640002C1 for ; Wed, 7 Apr 2021 02:53:25 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-ed; t=1617764000; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to : from; bh=AEkIgafzi7RpGn936tjGd8ecfLF4DBUsLsBZWtHC3mE=; b=jwq0GYnuqbluhacKNV+IS34m5Cy5apitjOcbiVWuIY1KAUeIpQE+zTHyBQwnrXTGYG83z jiPcnTahJuUp9RxDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-rsa; t=1617764000; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to : from; bh=AEkIgafzi7RpGn936tjGd8ecfLF4DBUsLsBZWtHC3mE=; b=QdC9Mh3eVoNrOVHPdwYVAcJtLFrR5Jq0+IwQluDDulUsFoXYdPJrnyFMRAXvuS4ofjZA6 i2QwKfDRfimkZuZTlqa9QmdRj3Ms3nlCMYEQ5rUaV99lmznXgVraoSXWxonpEu04vCoX3z9 na95oCqP/WOF1TdAVLBLx4W8qh83sYlWD4pEPrTqsVyp5jediQ7Zo2wTmEV3zQdpE2VnaUB 6jEht/ob8DyfXLM2DPgNAf5vQCGqNLs0otVdJknn0Bj0XR8UTGt3IkkviCvIIWzKJbgn4u4 cqYdg0Li7gDpd30NYcc/nK+ZztHMaRGAxuf43hOsNaLhtMxeN6SdPctvIhsw== Received: by server.lespinasse.org (Postfix, from userid 1000) id 489D81601D1; Tue, 6 Apr 2021 19:53:20 -0700 (PDT) Date: Tue, 6 Apr 2021 19:53:20 -0700 From: Michel Lespinasse To: Matthew Wilcox Cc: Michel Lespinasse , Linux-MM , Laurent Dufour , Peter Zijlstra , Michal Hocko , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Rom Lemarchand , Linux-Kernel Subject: Re: [RFC PATCH 24/37] mm: implement speculative handling in __do_fault() Message-ID: <20210407025320.GA19997@lespinasse.org> References: <20210407014502.24091-1-michel@lespinasse.org> <20210407014502.24091-25-michel@lespinasse.org> <20210407023527.GX2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407023527.GX2531743@casper.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 664F640002C1 X-Stat-Signature: ywrtayqantryz3bxoysgis4f43tmsoib Received-SPF: none (lespinasse.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=server.lespinasse.org; client-ip=63.205.204.226 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617764005-557253 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 Wed, Apr 07, 2021 at 03:35:27AM +0100, Matthew Wilcox wrote: > On Tue, Apr 06, 2021 at 06:44:49PM -0700, Michel Lespinasse wrote: > > In the speculative case, call the vm_ops->fault() method from within > > an rcu read locked section, and verify the mmap sequence lock at the > > start of the section. A match guarantees that the original vma is still > > valid at that time, and that the associated vma->vm_file stays valid > > while the vm_ops->fault() method is running. > > > > Note that this implies that speculative faults can not sleep within > > the vm_ops->fault method. We will only attempt to fetch existing pages > > from the page cache during speculative faults; any miss (or prefetch) > > will be handled by falling back to non-speculative fault handling. > > > > The speculative handling case also does not preallocate page tables, > > as it is always called with a pre-existing page table. > > I still don't understand why you want to do this. The speculative > fault that doesn't do I/O is already here, and it's called ->map_pages > (which I see you also do later). So what's the point of this patch? I have to admit I did not give much tought about which path would be generally most common here. The speculative vm_ops->fault path would be used: - for private mapping write faults, - when fault-around is disabled (probably an uncommon case in general, but actually common at Google). That said, I do think your point makes sense in general, espicially if this could help avoid the per-filesystem enable bit.