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 A156AC433B4 for ; Wed, 7 Apr 2021 21:20:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2EF7361165 for ; Wed, 7 Apr 2021 21:20:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EF7361165 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 B184E6B0073; Wed, 7 Apr 2021 17:20:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC7D36B0078; Wed, 7 Apr 2021 17:20:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 968BE6B007D; Wed, 7 Apr 2021 17:20:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 7C5966B0073 for ; Wed, 7 Apr 2021 17:20:29 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 391838794 for ; Wed, 7 Apr 2021 21:20:29 +0000 (UTC) X-FDA: 78006839778.38.008FD3A Received: from server.lespinasse.org (server.lespinasse.org [63.205.204.226]) by imf11.hostedemail.com (Postfix) with ESMTP id A1DB5200024C for ; Wed, 7 Apr 2021 21:20:23 +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=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) X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A1DB5200024C X-Stat-Signature: kk3qz96r4thn6ckdpb7zjcu8yaams3ze Received-SPF: none (lespinasse.org>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=server.lespinasse.org; client-ip=63.205.204.226 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617830423-201233 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 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.