Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp651573pxu; Thu, 3 Dec 2020 09:18:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5UptILNDGbQu41f4rKLZg7fRTRtZ3grOA5aCKNc4zNI1lf4+N+3/+Unjv0RzRTtZ4Up27 X-Received: by 2002:a17:907:b09:: with SMTP id h9mr3473058ejl.155.1607015889494; Thu, 03 Dec 2020 09:18:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607015889; cv=none; d=google.com; s=arc-20160816; b=v4GktopzD4ZVpIHeztnwaHEa2L1svulFfP2/duArsWXEhWyJIsR1RtgG6GBjHGStHa kqSoHaqV8994H2ItomXFCAfWj5OxOEaxkuxPNQa3kjWnRJXbCNUjKapYQxzSr6tZ1LJz KS3adpByHVuTmYoQTOQ4S55K0vgxZb0U4YRJB649DYeoQTQ4aTJBTlIBt7yVjMSDipZ+ sYvLGXVA8pqu6hrIDzWZamE/AhmHUqUEdgdWAiwaqGVL0WrKFgJkrU7xXDkS6GwJaWFQ cesGvjhWIdrdwLRHik02xbV8C2Esf7f8gZHK4sxfd9lNzWu5cKng9Ib66x3JaRyB5VpI lUWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=jpxIDRJby02bDSmzqib9oh8ZXDBqI+2pH5k0P2lzdWM=; b=kwcbAeG3QwAQHOD9I5WbsyzUCyKmx0gYnBB/k03yqgF1jfRB0Yix0sIigh/5i+lTZ0 EPjhoh7ZwdFoUsxb/UCpwD1j6nrE2ESgOAWa7bys0F9FoqkevsbXFWnxBsS6Ab9ffLtm BYOhgfToLYhHEMMosLHbzkciUSrAy8On12s2GwPH02NASphTa1hcxH0eyx0FqOmGmCF/ 2XKYiR3uUTAWANusxUjOni0rTl9G90R67/qDnuS/usrDBrF+fVUpVfmc3DFJ3GbkwJ+0 6YM++n92hcxKtaXVYIcTwh2yIEJGAHqsdeI/qqQQhFILhnfaucRSRk6Gx8ByifiBAaDM p+/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=aRJu1HO4; 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 ha25si1489038ejb.3.2020.12.03.09.17.36; Thu, 03 Dec 2020 09:18:09 -0800 (PST) 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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=aRJu1HO4; 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 S2387921AbgLCRPF (ORCPT + 99 others); Thu, 3 Dec 2020 12:15:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731419AbgLCRPF (ORCPT ); Thu, 3 Dec 2020 12:15:05 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 142CBC061A4F for ; Thu, 3 Dec 2020 09:14:25 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id p6so1494802plr.7 for ; Thu, 03 Dec 2020 09:14:25 -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=jpxIDRJby02bDSmzqib9oh8ZXDBqI+2pH5k0P2lzdWM=; b=aRJu1HO4xnNzb8jocw95sh/+CjsELYLpn2jhaJctdiBvV0Fo/IKe2d9DUjnFTVLurX Zz5jY6puhccVi4/XYJcF7M1WWjBZ/WYrYvOH0BlxpJnlRQ5Gv20I5Qa54qDavxIpMqu7 46YMj6QXtaEh429/CwE53Heyk8rCED0kC2GVSiksY3g51x/NcNUwhV8nC9XoV+cO/mxt 4h3T5yaHfoFjomEoJs048LrdfUJhUseSC4iy7RdIuoRUVb60jBp4vPTph+8LXJR4h17K q4oZzEwHYNz5a1MVWTTRm26Dfo5pZpVJIp2icQJRZ7CVgm0Yy3vM/31Kuj9RXfgsUNyL FvEQ== 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=jpxIDRJby02bDSmzqib9oh8ZXDBqI+2pH5k0P2lzdWM=; b=HbmVb1XjBkQgOi3YbfVZfID/J2rNVdtIYqYOYDb7KyDUx46zFdwKwM/kU0JHrIyAHM UcjNOuTajHqnW6HdvXSWn3RHS9Da1O2a9ALi40NWnbUI8hcJHM8EKHCQLsKv8ZeTe/Hj 9keXR99B/ZWfzFWwxk8bWEXG9d/Pd1o9mo5W8xsl3ozNm78RKq9sh+y+fjt05pMMfqm9 DfNYTDbAyDJ8nRKev9e4RpM6rV3WYu1MUbj4O/38rS3qN8MVTBm7gCiYiPsdWc1swTLr ML09p1+6E/wmL1q4baVz7Br002m7YGKTjq9geThE9k5NlFA0/KwFo/KVDw2QDXmtRhQa LzVQ== X-Gm-Message-State: AOAM532UPMENLLtKCEwI0+HQ9s1A2fXFOtimbnyk+C/U2S2W3T2tJ2fx BmpiNlfeqfbpi4I1LbeV2zXGxw== X-Received: by 2002:a17:90a:5988:: with SMTP id l8mr120805pji.82.1607015664612; Thu, 03 Dec 2020 09:14:24 -0800 (PST) Received: from ?IPv6:2600:1010:b02c:6432:59d6:b4ed:32aa:4315? ([2600:1010:b02c:6432:59d6:b4ed:32aa:4315]) by smtp.gmail.com with ESMTPSA id t9sm30146pjq.46.2020.12.03.09.14.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2020 09:14:23 -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: [PATCH 6/8] lazy tlb: shoot lazies, a non-refcounting lazy tlb option Date: Thu, 3 Dec 2020 09:14:22 -0800 Message-Id: References: <20201203170332.GA27195@oc3871087118.ibm.com> Cc: Andy Lutomirski , Will Deacon , Catalin Marinas , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Dave Hansen , Nicholas Piggin , LKML , X86 ML , Mathieu Desnoyers , Arnd Bergmann , Peter Zijlstra , linux-arch , linuxppc-dev , Linux-MM , Anton Blanchard In-Reply-To: <20201203170332.GA27195@oc3871087118.ibm.com> To: Alexander Gordeev X-Mailer: iPhone Mail (18B121) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 3, 2020, at 9:09 AM, Alexander Gordeev wro= te: >=20 > =EF=BB=BFOn Mon, Nov 30, 2020 at 10:31:51AM -0800, Andy Lutomirski wrote: >> other arch folk: there's some background here: >=20 >>=20 >> power: Ridiculously complicated, seems to vary by system and kernel confi= g. >>=20 >> So, Nick, your unconditional IPI scheme is apparently a big >> improvement for power, and it should be an improvement and have low >> cost for x86. On arm64 and s390x it will add more IPIs on process >> exit but reduce contention on context switching depending on how lazy >=20 > s390 does not invalidate TLBs per-CPU explicitly - we have special > instructions for that. Those in turn initiate signalling to other > CPUs, completely transparent to OS. Just to make sure I understand: this means that you broadcast flushes to all= CPUs, not just a subset? >=20 > Apart from mm_count, I am struggling to realize how the suggested > scheme could change the the contention on s390 in connection with > TLB. Could you clarify a bit here, please? I=E2=80=99m just talking about mm_count. Maintaining mm_count is quite expen= sive on some workloads. >=20 >> TLB works. I suppose we could try it for all architectures without >> any further optimizations. Or we could try one of the perhaps >> excessively clever improvements I linked above. arm64, s390x people, >> what do you think? >=20 > I do not immediately see anything in the series that would harm > performance on s390. >=20 > We however use mm_cpumask to distinguish between local and global TLB > flushes. With this series it looks like mm_cpumask is *required* to > be consistent with lazy users. And that is something quite diffucult > for us to adhere (at least in the foreseeable future). You don=E2=80=99t actually need to maintain mm_cpumask =E2=80=94 we could sc= an all CPUs instead. >=20 > But actually keeping track of lazy users in a cpumask is something > the generic code would rather do AFAICT. The problem is that arches don=E2=80=99t agree on what the contents of mm_cp= umask should be. Tracking a mask of exactly what the arch wants in generic c= ode is a nontrivial operation.