Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10892400rwd; Thu, 22 Jun 2023 06:18:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Y1EYVhrzRNjGONpdO/TFoJT20fmaAdvC0nlc3av92vowbFURpASNnPBchWG+pvkqpqILh X-Received: by 2002:a05:6a00:1351:b0:66a:5c68:8a03 with SMTP id k17-20020a056a00135100b0066a5c688a03mr1490785pfu.12.1687439905734; Thu, 22 Jun 2023 06:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687439905; cv=none; d=google.com; s=arc-20160816; b=lYp2tetCCHNJyrSK+LXSW/c0qzix+Vz7H6izDjENncvqIwqHnSX3UMXkT1CMhelAjn ODP2f6t34bpefqiZ4n0M8QpasIDcDf0Q/Tf7uvT3jdNcBR1ymYJBp2hPH3FulHNcc1Ml 8SJmdiRru7q/fUDrgHeRnPzY/uTrTfjQwASZWdrqdsgQlbDYdn9OngbzkWJ6Qo37jG8f ihoqh2WbcUaBg7lCwvIGLFkszYIpphn/+dVvE2WjmpUEZpb1CoFrVrRg8tmBezwKRkA7 3q/I5Abo6vFZyTTVijc5xPFQTv4sXBrD37z6bBNV+BrB3hLlV2uifUf8hZAqH+IuRL7m ukYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=sL8itRGmxApUKDOrvea4cRz5mnSUjX/8ZLxFKQlLox8=; b=dLaHqsUVsAkLZAEnq1MLheuZkFPcPh7BpT9K4b9CVmjMtdpvfeVF+UWdmp5im1Sgrj 2CgTJGPc9KSV8HfAzDa/C4EBaa/lNDjKKySfKfq7LBd13eZE2R4LE1KviYIyYiupIgPC Aa7YOsowD2Re6hRLaseHFZ/pOlbup0KgEwik/tMGJRLxFfky3mzNbgze0ydVH8SnfhJ6 PIiGH8cpRU78KkYeyX2Ceq7X152jBGd7OOiF5OwoECCY66Wfpyho3ZbnpNeeE8mktcXU VlYHB/ti6VKCfO00Sbw81azg5TQR4ynG10dsJ6Rbr+UYoXs04bzethY6Nr8wQ4qqlRD+ 3P5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CLGYB8PI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a63b955000000b00553c4551a09si2442586pgo.398.2023.06.22.06.18.13; Thu, 22 Jun 2023 06:18:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CLGYB8PI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjFVNMd (ORCPT + 99 others); Thu, 22 Jun 2023 09:12:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjFVNMb (ORCPT ); Thu, 22 Jun 2023 09:12:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 716121FE8 for ; Thu, 22 Jun 2023 06:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687439500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sL8itRGmxApUKDOrvea4cRz5mnSUjX/8ZLxFKQlLox8=; b=CLGYB8PI6b4R3Ja0/X/dITVP9zfCpmEHxZYg+ZbdgX79gZVY5007ypxpd3+obrThZJlrRD wuctEKM8wYyPmExS8rzxvvDFH2KVAaucv5HiN9FMN+JdvwwYmEKEayqkZD8G36FkK+bJBn 5n71BY3nNxQBeloGOZmih1Ym6iMvPwo= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-108-e9SRANF6OwaHclctya37uw-1; Thu, 22 Jun 2023 09:11:39 -0400 X-MC-Unique: e9SRANF6OwaHclctya37uw-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4f618172ed6so5329546e87.3 for ; Thu, 22 Jun 2023 06:11:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687439496; x=1690031496; h=content-transfer-encoding:mime-version:references:in-reply-to:date :cc:to:from:subject:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=sL8itRGmxApUKDOrvea4cRz5mnSUjX/8ZLxFKQlLox8=; b=kPKMC5xVrawUDznEPuFzOhr8UaCsi2f+aoBk0NJymnrOVxPyk3hgMydefnHXnAOuGF xuV572Qf8CKdHfZ66YcdEGb/ouqGd5TQWimQWxsz8k8mq3EWdzbX7dg9sGoafH/Ipl5y 1na/ykeCEbm4lu5IrA+j2lUvtxtMn/5sOIhhmj+wONRTmUkVVdmNVYvZy74rBIrTqII7 aW+hwUD4w/XiWhEeY7iPdsbxTqrZT7Fg3Sbyj+oV6TjotnS4aDvFYvYrjb12S8qezyFR vyqpB1jI45zVtKFzdhkB9AvrvxX6ujRMnxNlIUprMrrDuZlNA35hBfd6eCv41qk0mz4F repg== X-Gm-Message-State: AC+VfDxQKJ2WLtnKmBM/Ok7R33A2cL21KgV7TarqV4fTVpV96CSUyPru DBIBdOvdRnTdXpF+C59Rw0n+5E6L2wUWgYSuBD1jtx2I8UVZpES6Dx9LephKLuoVJkEJcK+MC8S vKfEGbsTQPl73XkxHdBoyQ6rB X-Received: by 2002:a19:7710:0:b0:4f8:6800:86f6 with SMTP id s16-20020a197710000000b004f8680086f6mr7663755lfc.49.1687439496651; Thu, 22 Jun 2023 06:11:36 -0700 (PDT) X-Received: by 2002:a19:7710:0:b0:4f8:6800:86f6 with SMTP id s16-20020a197710000000b004f8680086f6mr7663723lfc.49.1687439496259; Thu, 22 Jun 2023 06:11:36 -0700 (PDT) Received: from ypodemsk.tlv.csb (IGLD-84-229-250-192.inter.net.il. [84.229.250.192]) by smtp.gmail.com with ESMTPSA id k37-20020a05600c1ca500b003f9b3829269sm2706502wms.2.2023.06.22.06.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 06:11:35 -0700 (PDT) Message-ID: <7a9f193e6fa9db1d5fa0eb4a91927a866909f13c.camel@redhat.com> Subject: Re: [PATCH v2 0/2] send tlb_remove_table_smp_sync IPI only to necessary CPUs From: ypodemsk@redhat.com To: Peter Zijlstra Cc: mtosatti@redhat.com, ppandit@redhat.com, david@redhat.com, linux@armlinux.org.uk, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, keescook@chromium.org, paulmck@kernel.org, frederic@kernel.org, will@kernel.org, ardb@kernel.org, samitolvanen@google.com, juerg.haefliger@canonical.com, arnd@arndb.de, rmk+kernel@armlinux.org.uk, geert+renesas@glider.be, linus.walleij@linaro.org, akpm@linux-foundation.org, sebastian.reichel@collabora.com, rppt@kernel.org, aneesh.kumar@linux.ibm.com, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Thu, 22 Jun 2023 16:11:32 +0300 In-Reply-To: <20230621074337.GF2046280@hirez.programming.kicks-ass.net> References: <20230620144618.125703-1-ypodemsk@redhat.com> <20230621074337.GF2046280@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-22.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2023-06-21 at 09:43 +0200, Peter Zijlstra wrote: > On Tue, Jun 20, 2023 at 05:46:16PM +0300, Yair Podemsky wrote: > > Currently the tlb_remove_table_smp_sync IPI is sent to all CPUs > > indiscriminately, this causes unnecessary work and delays notable > > in > > real-time use-cases and isolated cpus. > > By limiting the IPI to only be sent to cpus referencing the > > effected > > mm. > > a config to differentiate architectures that support mm_cpumask > > from > > those that don't will allow safe usage of this feature. > > > > changes from -v1: > > - Previous version included a patch to only send the IPI to CPU's > > with > > context_tracking in the kernel space, this was removed due to race > > condition concerns. > > - for archs that do not maintain mm_cpumask the mask used should be > > cpu_online_mask (Peter Zijlstra). > > > > Would it not be much better to fix the root cause? As per the last > time, > there's patches that cure the thp abuse of this. > Hi Peter, Thanks for your reply. There are two code paths leading to this IPI, one is the thp, But the other is the failure to allocate page in tlb_remove_table, It is the the second path that we are most interested in as it was found to cause interference in a real time process for a client (That system did not have thp). So while curing thp abuses is a good thing, it will not unfortunately solve our root cause. If you have any idea of how to remove the tlb_remove_table_sync_one() usage in the tlb_remove_table()->tlb_remove_table_one() call path -- the usage that's relevant for us -- that would be great. As long as we can't remove that, I'm afraid all we can do is optimize for it to not broadcast an IPI to all CPUs in the system, as done in this patch. Thanks, Yair