Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp742683pxf; Wed, 7 Apr 2021 10:23:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx5VZfvkWxS1auE6N8VlC3lzjAE8sUXtQSgHow7TFuxR6BTPXrVmdlFEE0opOp2W8QP7C1 X-Received: by 2002:a92:d9c3:: with SMTP id n3mr3818974ilq.306.1617816231010; Wed, 07 Apr 2021 10:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617816231; cv=none; d=google.com; s=arc-20160816; b=hsE3G/u1I8v2a/9c4Z3uQIkgg/O0OMGl15bmF+kAJeYOEsvkNhSgQfECUIWxlV4/Z+ 2hdjl48MPf4ob4+qSY2jCXOEzLE360zrpZYJj6nYyIYhBFT7xI8+ty4KMl8H9QnyAoIX 7MUjXGgrsxt0xKuRwdv1KcizbxUWFRqEEuJdYD7m7mqbTrVq0vRQsCFzNzNHFOhsOpSp Nlx68KbfacDJroJHvpijn7Ha9WhhQ0mI5RIbiOY7r+PD3574/2SnRud1vazbDrJky1p6 UBerg/5URmsC4m6nj46KAFD3X+/Cd+qq06Rzl2PI3K2oirdQpnHLryQKd1e9yOdvgr+j QaZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=AEkIgafzi7RpGn936tjGd8ecfLF4DBUsLsBZWtHC3mE=; b=jnvAPcgrGa34W1KLLUMLwRTTeriCvCXO4KpAxSF4uJe2K2tFK9ayWzl5XGMoOZdvTn u0/pjzusbxGVp/7Cu9zEl6nEmIe4aJ4cZTgysm1jdUsagwPkv1bpZpGMQNLAppGp9PD7 C8bPo1Qp1svztUqgXp6+VOTTrohJkpFL0kgbCTCyRKSQQVe1jIucphOv3F00Cn4wQ3Fb 0F5xrjMAXKJ6rtmo88Lw53QJEXgOdX9JMGSInFhm+vV6UP5OJTFGDm+c8K0v5oWyfyhn du3ViPoI9M4JLUyCYT8F62ej5C8wHmX7jHhUDFay5pDziMlp/Tgs9aiWkfP/Zon48kqP LjXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.b=jwq0GYnu; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=QdC9Mh3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si22691710jad.47.2021.04.07.10.23.38; Wed, 07 Apr 2021 10:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.b=jwq0GYnu; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=QdC9Mh3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235466AbhDGCxj (ORCPT + 99 others); Tue, 6 Apr 2021 22:53:39 -0400 Received: from server.lespinasse.org ([63.205.204.226]:38929 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbhDGCxi (ORCPT ); Tue, 6 Apr 2021 22:53:38 -0400 X-Greylist: delayed 2802 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Apr 2021 22:53:36 EDT 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.