Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp920842pxf; Wed, 7 Apr 2021 15:06:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx4h/D8dENpRj6Lkw96XXRzOQXBpDHpwynjA89QFYbvX/M7x46kUmFTHHAd7a/keEwvcfv X-Received: by 2002:a17:902:9b92:b029:e6:b640:ad46 with SMTP id y18-20020a1709029b92b02900e6b640ad46mr4959269plp.56.1617833188366; Wed, 07 Apr 2021 15:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617833188; cv=none; d=google.com; s=arc-20160816; b=T8XVtOnJX+ZUfz3wJj+LRX9GppYLxx8I1utJtsTJdJPKiNWsfEOVIgFLJ69e4CWQFH eAIAI3D/6r6pY9Tc0AaFxaGn3EzUtpGI323vFINxVnjonxTJWdFYoDFwRkXVm7XtbfaA oCFFP7amDZayZoMgP3cdp3wTZNP0GlwQQTPY9SuQf0sh2280Q4Zhg9ZJJbsiOZkkupkl DHQ9g6IbPlSazQIrjLJcu136tNLMzzkd8aKYLdyFxzJa2MtvFjZIn3K1+D2ucXAMn6J1 jN55uyiaUBFUC2pyEdCzL259roMfrYbpA8XuMbgWZ0bZ7+9piRwgl3+LUUt+DJbf6dfj W2kQ== 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=ewiKB7dhg6JS2vHE/8Lo9U0JJBtdLJ6yYPYXNFQFb4A=; b=T+WRuzMkrjwK2i2+8U2rFnenqV+VbUh0JjihRlTUQ4mnp0YvoeueX+DGjdnF9MSxFQ UJ1uL6Rb8VJ1BN3qm3Fb1s6sxc7Ip7vbpJXci2qJpr0qS8vHzmfgXTW4Is5wm/lvpy8e ZaPVbyGQK6wNPCBjAZp9bDMlF8kBb8+JPbwnVlLBG7n/g5IjRAqgWaGAteMCCyLtVJLQ Puv/WwWHtUGLPYZ2fyjcR39g6m5uod0mDC3unSCZ7AayHifuETSnlrjWeDHlPmQtXihf CDA1XTOffZ3xOTlp5zpQqsVEx/66vGeNRSQhHaGpAMq6E1rinh9fuxSZ4+BGjNscYaiV wifg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-11-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=Jbs2G8vV; 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 br17si3269294pjb.161.2021.04.07.15.06.16; Wed, 07 Apr 2021 15:06:28 -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.s=srv-11-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=Jbs2G8vV; 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 S232214AbhDGVUi (ORCPT + 99 others); Wed, 7 Apr 2021 17:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232117AbhDGVUh (ORCPT ); Wed, 7 Apr 2021 17:20:37 -0400 Received: from server.lespinasse.org (unknown [IPv6:2602:303:fcdc:ce10::100:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0408C061760 for ; Wed, 7 Apr 2021 14:20:27 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-ed; t=1617830427; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to : from; bh=ewiKB7dhg6JS2vHE/8Lo9U0JJBtdLJ6yYPYXNFQFb4A=; b=H40D092KZHmVh9Hemd53LzCXHnVeS+uy+u06ihsSjJ9/40JGIdP6Za5ASsNMKgleffYS/ 8j4S8USLBmpu+iCAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-rsa; t=1617830427; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to : from; bh=ewiKB7dhg6JS2vHE/8Lo9U0JJBtdLJ6yYPYXNFQFb4A=; b=Jbs2G8vVC9byVJ+KMdCDayEwy19AtRD9dbCQ3ocMpKDazQB3A1wfEYicpes/tPw6zkuOf pDeZ/Xq7urwiXSOkZWpGn1zhsS5Q7RDP+kvf+dHRUbUn6jUkw2b8hQnuWEFPFarKJJn3uea 7k7sEGZjwc5uGjw3sh3OPQfE651xhd8TLPNlXwoInnwNsBf8y8igMzz8s6g1V91hEeWfav1 /XdaXeM4oKvDyq5pdeBTjmJwSKb3tso1n3VgzBPuTY85AxRfJI+1ytHMaZQTl9OeeJxKAmc qKLwyphqMdmGZLDk1zVXIV+315D6zA597S2zqzpFF9lMKO13q2ZFRcBq/EJQ== Received: by server.lespinasse.org (Postfix, from userid 1000) id 5003916024D; Wed, 7 Apr 2021 14:20:27 -0700 (PDT) Date: Wed, 7 Apr 2021 14:20:27 -0700 From: Michel Lespinasse To: Peter Zijlstra Cc: Michel Lespinasse , Linux-MM , Laurent Dufour , Michal Hocko , Matthew Wilcox , 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: <20210407212027.GE25738@lespinasse.org> References: <20210407014502.24091-1-michel@lespinasse.org> <20210407014502.24091-25-michel@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 04:40:34PM +0200, Peter Zijlstra 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. > > So what's wrong with SRCU ? Laurent mumbled something about frequent > SRCU kthread activity being a problem; is that still so and is that > fundamentally unfixable? > > Because to me it seems a much more natural solution to the whole thing. The short answer is that I did not try SRCU. My thought process was, page cache already uses an RCU read lock, I just need to expand its scope a little. Using SRCU might allow us to hit disk during speculative faults; OTOH we may need to switch to a more robust validation mechanism than the global counter to reap any benefits.