Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1705630pxy; Thu, 29 Apr 2021 12:37:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhYLsvUw69wv2DYsMD7nPwCcLmMuYOyv1R3iS2wX19p5/jEK58sUvOAL6UtyLfrKoSMpD9 X-Received: by 2002:aa7:c1c9:: with SMTP id d9mr1479482edp.155.1619725053824; Thu, 29 Apr 2021 12:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619725053; cv=none; d=google.com; s=arc-20160816; b=zmW6v+QR8rI9zne4YFKCIWopBuOC0sL1uyv3KS3zC7u9GrX4ljmXwdmQpEShSH3daY kQUhUO3ggbpAyB30QZXsW0md+GCSQP0TD5I61PlMpwDbIEA/or9fph0xXAxFLloHsXdC R3Zw9snevNqe9T3Ka5hDZfudjd1+/KwjCksplLpRdg9SUQwcLGyGOhucHtMBYaAoTzL+ NUeZqNcYuXMU8JpD/PT0ql1WY/TTLIbA8rDUUtF6TTjKMAv/GJGAQnDBm+quztMgEGPL pFwHPX7pU/VoA/MsFYwVV8eYDuQOevUTr4FvR08GPCC1zsXaQgmJLuzg8XtMx/G9NO6j K49A== 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=AuBuKJtfecHwtKNKpCmxc6lcyXSAmiHHw7MgDTeW7ko=; b=J3gEECsNABiWPw8ISkk36TO60DecSMRfljDZiu4bQ/cOJqCylqzPKp2j+b68pGTvFr 6vXrwK6UngM2t8fJay1J3BGpc1K6FrveAbi06GiJfMHCzE2ZlAoYwrtqAzGrVqgjITdy YZiw88/Io1oqBXWgW0061ZREHaW/H3lBHWYN4ZfumUpR1UpAvB71H7xKoJycpF9X8qF5 Z247vCJM+yWfAGTqAwWYZHAeNOO5ZhF4FGNnD42Qs6HuWl7MpciqCL1X3hGzj3bMETur OKphxMis1+xmKL0jfBeeNzJbx+mz7Rp4GMMmFbblv1AFeGZfxIwvIEjD9CCFWq5mE9pB w2dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JrwAldHM; 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 au12si969619ejc.51.2021.04.29.12.37.08; Thu, 29 Apr 2021 12:37:33 -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=JrwAldHM; 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 S233039AbhD2Tg7 (ORCPT + 99 others); Thu, 29 Apr 2021 15:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbhD2Tg4 (ORCPT ); Thu, 29 Apr 2021 15:36:56 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0C43C06138B for ; Thu, 29 Apr 2021 12:36:09 -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=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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.