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=-4.1 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 02D60C433E0 for ; Mon, 13 Jul 2020 04:58:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B21A52073A for ; Mon, 13 Jul 2020 04:58:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="twLvAk0Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B21A52073A 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 36C688D0003; Mon, 13 Jul 2020 00:58:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31D728D0002; Mon, 13 Jul 2020 00:58:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20BD98D0003; Mon, 13 Jul 2020 00:58:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0D1BE8D0002 for ; Mon, 13 Jul 2020 00:58:24 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BC3A3824CA22 for ; Mon, 13 Jul 2020 04:58:23 +0000 (UTC) X-FDA: 77031846486.28.part54_230e6b226ee5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 8A1166D66 for ; Mon, 13 Jul 2020 04:58:23 +0000 (UTC) X-HE-Tag: part54_230e6b226ee5 X-Filterd-Recvd-Size: 5337 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Jul 2020 04:58:23 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id u18so5476950pfk.10 for ; Sun, 12 Jul 2020 21:58:23 -0700 (PDT) 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=P9lvh6IbVzCStjX6UUqQ4hMLI1Givor5C1Gp3Fr1r88=; b=twLvAk0ZReArj6wfcl7hQ//jm11HXj/KFahAEPL+UM6ujjMxhZiF0A0GOyw2PNcD6n mpih/dpKWaQtDJIw68Mh6Mc/STHYFqpCPq5h12R3J5lg6CFdfbcacHxe/Hbw2um73nEr bYGFr3b9Btax772OMVBYuUmLxSf7OP35btmVMCe+X8dfchC/n+BTM4c9hQJgnzjZKXNs cOlxmSMsn5/NM+lPQSJGSh167XGYYbPSShRi+exUS8TdpmMudsYE/pFUxAFqyIS6bzXB byoyuNxro9XNx2Xd0kYoj7WbW86Izvr05PEjwIPv3cEJydPxXqXYo3/liFM/xZSJ6Hgq jchQ== 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=P9lvh6IbVzCStjX6UUqQ4hMLI1Givor5C1Gp3Fr1r88=; b=HRcw4cQg4uOXfEAHGz31pM3pCrf9XrcQDza8sBQqUBps85d+Ot3GM+j0QolrlW3JcV E4yZpZZEJ+Urk1txzonFIvU4XrPecU2E2Gy/T04aJ6tccU9VD80UQmX31yL1N5p/e5Zm VyOLEtikeGAoBxu4fdCfE8hhK3z7DBL/boZWf/0NWvoyeNFqiiHa9B75lBxpF7kx/TSw weAr9pbvhX/OErQvxDJbvmqDmvxdRayVvt2yHW9pKiUfVkwWcGV5bK48MsXdPVH1F49e Ux8cMNy1goMVsQN1tgDHGbyVtrN55UZZr5Kce5FDxCpMH0Xawl7DNVCFXIGBjKB95DZb lp8w== X-Gm-Message-State: AOAM532ZFjWGd1IlJbmsHVNEU5DcoQgxJwrEQONR5uQ+yB2KFSa5A6h1 UXT2S1wLiZHfCcDq+iiPYT8= X-Google-Smtp-Source: ABdhPJyVdzyfh+4/fnCB+gvx/RI5CNBM3ozikU//q1BXlfMf+CY/xIg+P4iZrF3k5Z/5NYCTX1F4YQ== X-Received: by 2002:a63:4543:: with SMTP id u3mr62898286pgk.398.1594616302094; Sun, 12 Jul 2020 21:58:22 -0700 (PDT) Received: from localhost (110-174-173-27.tpgi.com.au. [110.174.173.27]) by smtp.gmail.com with ESMTPSA id g5sm13135499pfh.168.2020.07.12.21.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 21:58:21 -0700 (PDT) Date: Mon, 13 Jul 2020 14:58:16 +1000 From: Nicholas Piggin Subject: Re: [RFC PATCH 7/7] lazy tlb: shoot lazies, a non-refcounting lazy tlb option To: Peter Zijlstra Cc: Anton Blanchard , Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Mathieu Desnoyers , x86@kernel.org References: <20200710015646.2020871-1-npiggin@gmail.com> <20200710015646.2020871-8-npiggin@gmail.com> <20200710093556.GY4800@hirez.programming.kicks-ass.net> In-Reply-To: <20200710093556.GY4800@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Message-Id: <1594615574.lowminiy4u.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8A1166D66 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 July 10, 2020 7:35 pm: > On Fri, Jul 10, 2020 at 11:56:46AM +1000, Nicholas Piggin wrote: >> On big systems, the mm refcount can become highly contented when doing >> a lot of context switching with threaded applications (particularly >> switching between the idle thread and an application thread). >>=20 >> Abandoning lazy tlb slows switching down quite a bit in the important >> user->idle->user cases, so so instead implement a non-refcounted scheme >> that causes __mmdrop() to IPI all CPUs in the mm_cpumask and shoot down >> any remaining lazy ones. >>=20 >> On a 16-socket 192-core POWER8 system, a context switching benchmark >> with as many software threads as CPUs (so each switch will go in and >> out of idle), upstream can achieve a rate of about 1 million context >> switches per second. After this patch it goes up to 118 million. >=20 > That's mighty impressive, however: Well, it's the usual case of "find a bouncing line and scale up the machine size until you achieve your desired improvements" :) But we are looking at some fundamental scalabilities and seeing if we can improve a few things. >=20 >> +static void shoot_lazy_tlbs(struct mm_struct *mm) >> +{ >> + if (IS_ENABLED(CONFIG_MMU_LAZY_TLB_SHOOTDOWN)) { >> + smp_call_function_many(mm_cpumask(mm), do_shoot_lazy_tlb, (void *)mm,= 1); >> + do_shoot_lazy_tlb(mm); >> + } >> +} >=20 > IIRC you (power) never clear a CPU from that mask, so for other > workloads I can see this resulting in massive amounts of IPIs. >=20 > For instance, take as many processes as you have CPUs. For each, > manually walk the task across all CPUs and exit. Again. >=20 > Clearly, that's an extreme, but still... We do have some issues with that, it does tend to be very self-limiting though, short lived tasks that can drive lots of exits won't get to run on a lot of cores. It's worth keeping an eye on, it may not be too hard to mitigate the IPIs doing something dumb like collecting a queue of mms before killing a batch of them. Thanks, Nick