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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 17E9CC433FE for ; Fri, 4 Dec 2020 02:18:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8409E22510 for ; Fri, 4 Dec 2020 02:18:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8409E22510 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 01BC66B005C; Thu, 3 Dec 2020 21:18:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0C0D6B0068; Thu, 3 Dec 2020 21:18:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFAF86B006C; Thu, 3 Dec 2020 21:18:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id C5FF16B005C for ; Thu, 3 Dec 2020 21:18:03 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 93584181AEF2A for ; Fri, 4 Dec 2020 02:18:03 +0000 (UTC) X-FDA: 77553989646.07.chin71_2f0f0f9273c0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 774CE1803F9AB for ; Fri, 4 Dec 2020 02:18:03 +0000 (UTC) X-HE-Tag: chin71_2f0f0f9273c0 X-Filterd-Recvd-Size: 4883 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Dec 2020 02:18:02 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id o4so2613982pgj.0 for ; Thu, 03 Dec 2020 18:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=Fd2ivA1JfGBE/YYaFxTeQJoY+3hIQ82HTGN9ThwBn8w=; b=bd67G5cfWvkCpWSjpFtI1+6l2zRYD23xLf/mhlvIDACjrdi9nyf9dA0r6nvvREyg08 f3/zsofCKY9aHt8SOxoMx94nNle0IBiOTvBwYKGdD9BVOEcCdLCVu0I6aOeaq7weUEWd EEIsrpT29dZ7HUU6IaIcUu+7qyqHljF6kf1ZearRQIWy4NWCn0VtkvVswIJqSbx1kOPr WLin59SvycwQtsrRgOoTfDikupSHB/+1QbEuAminucunl/PpeQO2nhXPBX/ZUzrub1eG EpYVkC2O08NhLbUm2XXwT50LKLrJr4vr8BkrzMgNmwHT5STBd5lQTFYdQbdw0F0SfX1w 5njw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=Fd2ivA1JfGBE/YYaFxTeQJoY+3hIQ82HTGN9ThwBn8w=; b=inOu5Y9yTvM33caZM79EmEprgLTgPK9YmshYz2puyOSBmAeYLkDyBD5ktEaHrjLfE7 rsTwBUpiZtMAKR8pXbbmVvVanJO0P96SQb+PIsgmL1g2ygjW+jJFKdM6QFyz1XPUYipd H19iCtEIjqei8iarMsIWLYiPWLxZGLbgmLE33SYkrihQ57078qJx42s7OJNNhTW/TNLx EKHyJx4H2RFVtmpwmIsurv1QABQRZkihQDZZxABzIBh5RtYCUoyxc5HAQ/IlnNfxM4jx 4cepD1kqfddbUFQR0/p+UhHHOdywO6062NLMXkfrX5bxWNBHoEqn4bd8hSlWSDp4TIEL FGFA== X-Gm-Message-State: AOAM531CAuoC6NG5+8saPXo1dS20bb/RXO81LolH8zbxd2irwm+IvVPu VWEpEpkOoffUplCP+NV2sTgPGg== X-Google-Smtp-Source: ABdhPJyNuKKB+iExcQqlDxHUMCskHI2/BePAL+9W0Ez0GHtzU2CIr3B8j01gRJIOeumT/wnwKHF+4w== X-Received: by 2002:a63:f64c:: with SMTP id u12mr5577532pgj.325.1607048281788; Thu, 03 Dec 2020 18:18:01 -0800 (PST) Received: from ?IPv6:2600:1010:b052:49bb:5861:3d22:1fe4:dfb5? ([2600:1010:b052:49bb:5861:3d22:1fe4:dfb5]) by smtp.gmail.com with ESMTPSA id v17sm2249260pga.58.2020.12.03.18.18.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2020 18:18:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [MOCKUP] x86/mm: Lightweight lazy mm refcounting Date: Thu, 3 Dec 2020 18:17:59 -0800 Message-Id: <3B47C470-2900-4A53-9F8E-CB3A003FA361@amacapital.net> References: <1607033145.hcppy9ndl4.astroid@bobo.none> Cc: Andy Lutomirski , Peter Zijlstra , Anton Blanchard , Arnd Bergmann , Catalin Marinas , Dave Hansen , linux-arch , LKML , Linux-MM , linuxppc-dev , Mathieu Desnoyers , Rik van Riel , Will Deacon , X86 ML In-Reply-To: <1607033145.hcppy9ndl4.astroid@bobo.none> To: Nicholas Piggin X-Mailer: iPhone Mail (18B121) 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 Dec 3, 2020, at 2:13 PM, Nicholas Piggin wrote: >=20 > =EF=BB=BFExcerpts from Peter Zijlstra's message of December 3, 2020 6:44 p= m: >>> 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. >=20 > 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. v2 fixes this and is generally much nicer. I=E2=80=99ll send it out in a cou= ple hours. >=20 > 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. >=20 > Thanks, > Nick