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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 185A1C433ED for ; Wed, 7 Apr 2021 21:28:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 932C26103E for ; Wed, 7 Apr 2021 21:28:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 932C26103E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0AF8B6B0073; Wed, 7 Apr 2021 17:28:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05FAA6B0078; Wed, 7 Apr 2021 17:28:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E42726B007D; Wed, 7 Apr 2021 17:28:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id CA3F96B0073 for ; Wed, 7 Apr 2021 17:28:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8806A121A for ; Wed, 7 Apr 2021 21:28:00 +0000 (UTC) X-FDA: 78006858720.20.AB7D35B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 6E477C0007CB for ; Wed, 7 Apr 2021 21:28:00 +0000 (UTC) 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=otglDvep5sGkMy7KSFfJkw3zbakk63WSycFVlUg1TqE=; b=k210fC5qr7A1PRLdfR1aLQElA6 0DIe535HrWQzEyYMzcAdiU3nutuYI1KV7Kq+n3O+Qwd371xG62ipWeRoGx2yChAsT+y0tQWP50hkB pAwNSOlsY8ughxldJagntHF+qUDKQfvr68rUgIRHrytmVtWGVpXPdjw5PFInOJM0Y0hMMo+nijP2d Nx5uEWIWEFxURPhfHavS28wdP97gS9zlKx4eVpRqgjjcwy9VQn5kbvnu9pABlKZ0014LBLu3dsYMv 8/CVF2jQGOm7ZH0U5rzxv+Ey1/kaAp4IrFzZ+wFK+ryVQqCZcE8Z0CUiIQwERNb9Ggag7NjBQ2iqV enWi+B9A==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lUFhg-00F7NP-FZ; Wed, 07 Apr 2021 21:27:31 +0000 Date: Wed, 7 Apr 2021 22:27:12 +0100 From: Matthew Wilcox To: Michel Lespinasse Cc: Peter Zijlstra , Linux-MM , Laurent Dufour , 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: <20210407212712.GH2531743@casper.infradead.org> References: <20210407014502.24091-1-michel@lespinasse.org> <20210407014502.24091-25-michel@lespinasse.org> <20210407212027.GE25738@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407212027.GE25738@lespinasse.org> X-Rspamd-Queue-Id: 6E477C0007CB X-Stat-Signature: tzaggh598p3aj3kxcuc6q8451gfd5w4a X-Rspamd-Server: rspam02 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf06; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617830880-924455 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 02:20:27PM -0700, Michel Lespinasse wrote: > 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. Why would you want to do I/O under SRCU?! The benefit of SRCU is that you can allocate page tables under SRCU. Doing I/O without any lock held already works; it just uses the file refcount. It would be better to use a vma refcount, as I already said.