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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 521AEC433FE for ; Thu, 3 Dec 2020 22:13:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B45FD2220F for ; Thu, 3 Dec 2020 22:13:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B45FD2220F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DE7B66B0036; Thu, 3 Dec 2020 17:13:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D980C6B005C; Thu, 3 Dec 2020 17:13:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAD368D0001; Thu, 3 Dec 2020 17:13:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id B50326B0036 for ; Thu, 3 Dec 2020 17:13:51 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7A4E58249980 for ; Thu, 3 Dec 2020 22:13:51 +0000 (UTC) X-FDA: 77553374262.12.burn47_4e0490f273bf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 590A718019992 for ; Thu, 3 Dec 2020 22:13:51 +0000 (UTC) X-HE-Tag: burn47_4e0490f273bf X-Filterd-Recvd-Size: 4593 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Dec 2020 22:13:50 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id l11so1968187plt.1 for ; Thu, 03 Dec 2020 14:13:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=eEmxf4uLm5+F9e4VAD5l7evhNTpueoEKmJf7NHBSgF8=; b=UPHGqln5b2MVwkQJ9DPW4W+c/WOYPO4pDdYgSkuUBuPAEool6k1o9tCh15tbT9uHrK Att6CPPLElr2Kizx6k8SBYlHiYybik+D2pHNYrEi6lvIa/OVMCqcofSbjZiFQCWNagWm gpfCcQKaP4yJ2ZfKAd6w0i3b/1ey0c1DO4esRuIh3lZT4EjH/cz8VKCKfqyuShuaeYhd x0YLD40CLwN02ITpU2TIn1dchmgPuXgxg9Hw3uQ8i6iktCUFcnDMyR1iVOdnAXdjnV9J dlREfCYAI47ZTNuw4m686ZqB4sYG5SbZx+ElCOdLB971GcExKVCtR58og1IlVpDkeiRG GVzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=eEmxf4uLm5+F9e4VAD5l7evhNTpueoEKmJf7NHBSgF8=; b=GKH2EPoJmKG7LU5xwHXeUpxNu6MicDaRcuhA1yds+lrsIeHX9q+nUxF4oNDH/kMI5h ZDfU9Ne+/oZhIKrFO/5WFjB5Cy89d6bwa7tU5qmKjh8sZDHh8l9Nl2FlaO5CFP9LqCVW gE+EOAE0KI+5hRGdJEdvHZmGmg+iF6CVNp7cYFWd16EGRbd40CBKb2uAKsVUKxfWMld/ cO9g49N6MXGrBDIxLTeoyzl6AnhqVToMHaVUNji+1DNA+QyUKrj72uVFu5ZhdqEDju26 6vY/aC3cPZSktASB9NjQym1fP3e0QA0pJxKHD8YmAwYFgNIM4VjANAO96EW6GerUHw7I TlkA== X-Gm-Message-State: AOAM530WAj1AC2aAfsCgRDagrwPNEBdKdyKz5/R5HyFgjVI9x9NvEB/L Y6GvuZIOPXvpOfORlEpEDvU= X-Google-Smtp-Source: ABdhPJz9kr0b40p8QhJurdR1DemR7fcJ+w7w3vdRbJJ4sHZwhGLmJpARUd3RcgIEF27oxEAuC/OzQg== X-Received: by 2002:a17:90a:d308:: with SMTP id p8mr1145716pju.110.1607033630047; Thu, 03 Dec 2020 14:13:50 -0800 (PST) Received: from localhost ([2001:8004:1480:55d9:df22:9c5d:bdf7:7c2b]) by smtp.gmail.com with ESMTPSA id kb12sm318120pjb.2.2020.12.03.14.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 14:13:49 -0800 (PST) Date: Fri, 04 Dec 2020 08:13:40 +1000 From: Nicholas Piggin Subject: Re: [MOCKUP] x86/mm: Lightweight lazy mm refcounting To: Andy Lutomirski , Peter Zijlstra Cc: Anton Blanchard , Arnd Bergmann , Catalin Marinas , Dave Hansen , linux-arch , LKML , Linux-MM , linuxppc-dev , Mathieu Desnoyers , Rik van Riel , Will Deacon , X86 ML References: <7c4bcc0a464ca60be1e0aeba805a192be0ee81e5.1606972194.git.luto@kernel.org> <20201203084448.GF2414@hirez.programming.kicks-ass.net> In-Reply-To: <20201203084448.GF2414@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Message-Id: <1607033145.hcppy9ndl4.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Excerpts from Peter Zijlstra's message of December 3, 2020 6:44 pm: > On Wed, Dec 02, 2020 at 09:25:51PM -0800, Andy Lutomirski wrote: >=20 >> 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.=20 >=20 > 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. >=20 > 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. Yeah this is the concern, I looked at things that add cost to the idle switch code and it gets hard to justify the scalability improvement when you slow these fundmaental things down even a bit. I still think working on the assumption that IPIs =3D scary expensive=20 might not be correct. An IPI itself is, but you only issue them when=20 you've left a lazy mm on another CPU which just isn't that often. Thanks, Nick