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 3F6B0C63777 for ; Thu, 3 Dec 2020 08:45:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E46221D1A for ; Thu, 3 Dec 2020 08:45:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E46221D1A 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 D24666B005C; Thu, 3 Dec 2020 03:45:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CAEEB6B005D; Thu, 3 Dec 2020 03:45:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9E2D6B0068; Thu, 3 Dec 2020 03:45:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id A16676B005C for ; Thu, 3 Dec 2020 03:45:16 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 639C0362E for ; Thu, 3 Dec 2020 08:45:16 +0000 (UTC) X-FDA: 77551336632.29.mist97_620179f273ba Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 4862C180868F8 for ; Thu, 3 Dec 2020 08:45:16 +0000 (UTC) X-HE-Tag: mist97_620179f273ba X-Filterd-Recvd-Size: 3408 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Dec 2020 08:45:15 +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=1OEgnGuQFuI6Gn7QkYFIDKg88w72Hop5JzkcqtFY01U=; b=KnUZMR2E0OA212RImg8ZoBoH1N fZ6ySlqUg1wR+HXlM4c8Cp66U/6dh/4QnvZU+vB78c5+WlMX+N5BiFhhTRK/TEhm1OnhAXuNPE6wc QDN2QO+G5xABTZpTVvsC1W5twZdY1J2bYIpA3UHJD03WwzisN4E+4FPJVx0rIxp8yERdesRdEfiFY jlFenRf8dqKXLKdzaE9TPn5S+3MrJbr2Mfe/i5hsXvGnaaE7K5Q8PPB1oKas0GcyHOpxanHe9DFOa ijFd9/V+shTG5q/pQr0fMD652yBXv6jrCEDUsUWyL7fmF4i+83NMaxmh7YvIG0Y9IBtO9WjhF/EGX +ycKF7MA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkkEO-0000cK-M2; Thu, 03 Dec 2020 08:44:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E811E30018A; Thu, 3 Dec 2020 09:44:48 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C98D420270BBE; Thu, 3 Dec 2020 09:44:48 +0100 (CET) Date: Thu, 3 Dec 2020 09:44:48 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Nicholas Piggin , Anton Blanchard , Arnd Bergmann , linux-arch , LKML , Linux-MM , linuxppc-dev , Mathieu Desnoyers , X86 ML , Will Deacon , Catalin Marinas , Rik van Riel , Dave Hansen Subject: Re: [MOCKUP] x86/mm: Lightweight lazy mm refcounting Message-ID: <20201203084448.GF2414@hirez.programming.kicks-ass.net> References: <7c4bcc0a464ca60be1e0aeba805a192be0ee81e5.1606972194.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c4bcc0a464ca60be1e0aeba805a192be0ee81e5.1606972194.git.luto@kernel.org> 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, Dec 02, 2020 at 09:25:51PM -0800, Andy Lutomirski wrote: > power: same as ARM, except that the loop may be rather larger since > the systems are bigger. But I imagine it's still faster than Nick's > approach -- a cmpxchg to a remote cacheline should still be faster than > an IPI shootdown. While a single atomic might be cheaper than an IPI, the comparison doesn't work out nicely. You do the xchg() on every unlazy, while the IPI would be once per process exit. So over the life of the process, it might do very many unlazies, adding up to a total cost far in excess of what the single IPI would've been. And while I appreciate all the work to get rid of the active_mm accounting; the worry I have with pushing this all into arch code is that it will be so very easy to get this subtly wrong.