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.5 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 D1801C433ED for ; Thu, 29 Apr 2021 19:35:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F15726147D for ; Thu, 29 Apr 2021 19:35:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F15726147D 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 4C0FE6B006C; Thu, 29 Apr 2021 15:35:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 497C56B006E; Thu, 29 Apr 2021 15:35:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35ED46B0070; Thu, 29 Apr 2021 15:35:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 15EE26B006C for ; Thu, 29 Apr 2021 15:35:30 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CE883180ACF1F for ; Thu, 29 Apr 2021 19:35:29 +0000 (UTC) X-FDA: 78086408778.03.5FF613A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 32A68E000133 for ; Thu, 29 Apr 2021 19:35:26 +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=AuBuKJtfecHwtKNKpCmxc6lcyXSAmiHHw7MgDTeW7ko=; b=JrwAldHMLpLgEzU0P7+eBtdIWD TKHT2PzsS5jt8F3IoPwNFkuypPPQtIgd3ZETtz9Z4zU0DBLbhDVZdX2mWomE/51XA4822ajz6/zbT DyhKWMAbD+9IeA6yiCGjuUG5hJixoez1oQVYGrS4lP5sb4yW3x1VoaoqzG3KVxXBS1h6VRk/W7u5t 3HI6xNURfQoXVTT1iO18RRaAfcleLYXlUo+ErlmgpOXCfeJoltW9IJa4Q/CqoFKSOSRKB9Jgus5Yi JM7WYLTdWnMoFle+d9wVwE4vYqu5bpUJRg+QXPlrolbPCFi7ol5BPIt+PgfCe7RSsxycFvQDhgI4w 6f8feC4A==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lcCR6-00A3cd-MN; Thu, 29 Apr 2021 19:35:01 +0000 Date: Thu, 29 Apr 2021 20:34:56 +0100 From: Matthew Wilcox To: Michel Lespinasse Cc: Andy Lutomirski , "Paul E. McKenney" , Linux-MM , Laurent Dufour , Peter Zijlstra , Michal Hocko , Rik van Riel , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Rom Lemarchand , Linux-Kernel Subject: Re: [RFC PATCH 13/37] mm: implement speculative handling in __handle_mm_fault(). Message-ID: <20210429193456.GI1847222@casper.infradead.org> References: <20210407014502.24091-1-michel@lespinasse.org> <20210407014502.24091-14-michel@lespinasse.org> <20210428145823.GA856@lespinasse.org> <20210428161108.GP975577@paulmck-ThinkPad-P17-Gen-1> <20210429000225.GC10973@lespinasse.org> <20210429161234.GG1847222@casper.infradead.org> <20210429191428.GD10973@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210429191428.GD10973@lespinasse.org> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 32A68E000133 X-Stat-Signature: 7g68c9hceaw9yuwjresc5x613jibxtrd Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619724926-515259 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 Thu, Apr 29, 2021 at 12:14:28PM -0700, Michel Lespinasse wrote: > On Thu, Apr 29, 2021 at 05:12:34PM +0100, Matthew Wilcox wrote: > > One of the worst things we can do while holding a spinlock is take a > > cache miss because we then delay for several thousand cycles to wait for > > the cache line. That gives every other CPU a really long opportunity > > to slam into the spinlock and things go downhill fast at that point. > > We've even seen patches to do things like read A, take lock L, then read > > A to avoid the cache miss while holding the lock. > > I understand the effect your are describing, but I do not see how it > applies here - what cacheline are we likely to miss on when using > local_irq_disable() that we wouldn't touch if using rcu_read_lock() ? It's the same cache lines in both cases. The difference is that in one case we have interrupts disabled (and a spinlock held? i wasn't clear on that) and in the other case, we just have preemption disabled. > > What sort of performance effect would it have to free page tables > > under RCU for all architectures? It's painful on s390 & powerpc because > > different tables share the same struct page, but I have to believe that's > > a solvable problem. > > I agree using RCU to free page tables would be a good thing to try. > I am afraid of adding that to this patchset though, as it seems > somewhate unrelated and adds risk. IMO we are most likely to find > justification for pushing this if/when we try accessing remote mm's without > taking the mmap lock, since disabling IPIs clearly wouldn't work there. I think that needs to happen _before_ this patchset. Creating a mess and then trying to clean it up later isn't a great way to do development.