Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp921794pxf; Wed, 7 Apr 2021 15:07:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhlHlN8JsMAGuChbLlS/aeIGnbQjcSPDfkbjzrYpBV6Qfpz3xxtFJWxSjyVdScfRagdeAI X-Received: by 2002:aa7:91d1:0:b029:1fe:2a02:73b9 with SMTP id z17-20020aa791d10000b02901fe2a0273b9mr4687079pfa.2.1617833266351; Wed, 07 Apr 2021 15:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617833266; cv=none; d=google.com; s=arc-20160816; b=HjL+dm8AIJaDJenjy8p72J2CnYPvi65SftrV/gjVyOzCCQ+BrKYw6iKIOVjWg4PvZI LwBDLoZAgtagUkJ85BdZEQYy3jraFCQcydu0kdxtunRsbxiaKBSbrsrcRKywiEnf/ZOj +MJlu6ZaGBRcqBFqd88MaI/7S2FlauQHc6IOWoFkN8HbCKUEKm4QRRuw1fGHzgmGX0z+ mUMfWg3uGNCwPKwq/rAllm17DmfIRU+s79kzvA+zRVzNxykik8HAqAvOhoc/TuEUjokO +8+cJqejdTkieo61SXM+E0muQ8seWc287FiZqO+05T/GCY/xSNP6iKs9sFB/22uZc8Fb pbBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=otglDvep5sGkMy7KSFfJkw3zbakk63WSycFVlUg1TqE=; b=Ve6T5kEqTHG/I58/ZqzH6QyTkEKnGPQ/uGXYQLtTakaLOxuN+2adcOTlgLnirHwAtj T7rEAfKypc/Vcu1UbZrEst8Y2tyd646KvCxQ5Eh3z3cCEGcqN/oMxThQQVSWQxcvBmgE R7S0Ciljqp0ntgiUzubFoh6o7mDyXCCIrAKShz5QV8TkeTopW/uyMsYo8TaDVhEwgt8A p+/xFBZfea+zJeR54jEzCtmYmEB6srR/RPwareWCiOCe1Nl1u7uihVSnPc5qI9oWc6Al OMrl1O+Z9nh8xmxQFfaZdDgC3f9jIgKXrKcCsouQiysVPYMGLoMXANFGsinlKvFr9xyL HAxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=k210fC5q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y204si25727434pfb.170.2021.04.07.15.07.34; Wed, 07 Apr 2021 15:07:46 -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=pass header.i=@infradead.org header.s=casper.20170209 header.b=k210fC5q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233155AbhDGV2t (ORCPT + 99 others); Wed, 7 Apr 2021 17:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbhDGV2s (ORCPT ); Wed, 7 Apr 2021 17:28:48 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB9C3C061761 for ; Wed, 7 Apr 2021 14:28:38 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.