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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE689C7618D for ; Thu, 6 Apr 2023 13:38:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 298096B0074; Thu, 6 Apr 2023 09:38:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2211D6B0075; Thu, 6 Apr 2023 09:38:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C2546B0078; Thu, 6 Apr 2023 09:38:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F33206B0074 for ; Thu, 6 Apr 2023 09:38:30 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AD92F121306 for ; Thu, 6 Apr 2023 13:38:30 +0000 (UTC) X-FDA: 80651070780.08.2BF8ABE Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id E485D40010 for ; Thu, 6 Apr 2023 13:38:27 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ayo4gvUW; dmarc=none; spf=none (imf27.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680788308; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rsfbSrxkyNUKnA+3L2zt42sf6Zqq9lCcgt0uWjy7k60=; b=Dwvo1xeBTAAc0EZL4SQRtAO/kER8nXl0fRf17QW7S+q1B0z4zxctdei/SFJc3BNh2ApL+c vFaV+M0f0p9StlAA4bCTcQ75kHWm3h4jgHYq5puKvMGavmdOE9DNWnyI9U3iTZgo8X05g8 XFqYWECtT3XV1CnwWp5JICJMAQstTA0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ayo4gvUW; dmarc=none; spf=none (imf27.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680788308; a=rsa-sha256; cv=none; b=8UKEswf76R4CE5zMjeqtyBssfJ/g82G5I169kZIj3P7DAGw3iuMoi80OnsP5L20KSoXX1U veQpvA+FPzB2BaYe1EnxDRNAfCbryjFcbrDJtODzy5aA4f4j2COiOwppoamghv8BuKOMRH SL/XrAmPAKUbLirBBq447dPwSiA13oY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rsfbSrxkyNUKnA+3L2zt42sf6Zqq9lCcgt0uWjy7k60=; b=Ayo4gvUWmcUkBURpVFBSM+eYhV l7P2VtXOZBB6jb1wtuH+SdKdAItVAe+kMpSzp3YHtSIOle0g7qoCA/xj5KLlB2TlzHd4JmzQKG0FG ctlJPIo/yJy3hcmtZqn4NrRTzxtN/fnZe8ae5QDZOAmpGmMl3PtsYG2hCbTsLjgSNkrwGT4IOrh74 AX3ervbDbcchBnb5NvAJ5/MXEGpH67rwaQ648BB6lvgDw2ZlLdz6jKQfgBg5U/zbLSkUQry3H0GEj zy0FeIX/yV9L32RTQOxJW9GjquZ0APcE4Plys2ZHWAXHTK7OJBep9Io61I07aKVmKD7SgpcMnYUx2 9zUW7zgw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pkPoU-00HSLt-Th; Thu, 06 Apr 2023 13:38:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 690B43000DC; Thu, 6 Apr 2023 15:38:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4F208212E36AE; Thu, 6 Apr 2023 15:38:05 +0200 (CEST) Date: Thu, 6 Apr 2023 15:38:05 +0200 From: Peter Zijlstra To: Valentin Schneider Cc: Frederic Weisbecker , Yair Podemsky , 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, x86@kernel.org, hpa@zytor.com, will@kernel.org, aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, arnd@arndb.de, keescook@chromium.org, paulmck@kernel.org, jpoimboe@kernel.org, samitolvanen@google.com, ardb@kernel.org, juerg.haefliger@canonical.com, rmk+kernel@armlinux.org.uk, geert+renesas@glider.be, tony@atomide.com, linus.walleij@linaro.org, sebastian.reichel@collabora.com, nick.hawkins@hpe.com, linux-kernel@vger.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, mtosatti@redhat.com, dhildenb@redhat.com, alougovs@redhat.com Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode Message-ID: <20230406133805.GO386572@hirez.programming.kicks-ass.net> References: <20230404134224.137038-1-ypodemsk@redhat.com> <20230404134224.137038-4-ypodemsk@redhat.com> <20230405114148.GA351571@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E485D40010 X-Stat-Signature: bbfg355kw5xpgy1ujkwxkmdutj7rq6u7 X-HE-Tag: 1680788307-257890 X-HE-Meta: U2FsdGVkX1/VbQ3CzQ2YRrYJ834dHI0LvQ8P0/XcbOPMq183TvDI9cqNuv8cFjRbPLi+c9Mi2Qx0eOpvkn0AVg8s9MCNhctesQWUpULSlwt7g4iKjYtg1kEVTsWB8385Hinq//Dsfd6VGyI8Zvt+Y/wwZW8C9KHX1/3UoCfCQGfyPJhsOaIvaa+uGBhSY7Wb6hMYno/Q6qGVfLRDriSY6Z7yFS4yTlKChamtcfMhO+ZxYAhFTJjBfQQQ/eivRYs9mpPZBO0pe2btwCI915wmlxw5BMTKJIfNYHnEwT20WJSPx6NSnm0KV8V3A2ox9Pvp3X1xNOSrNF+mVKhJfXUH74o8HWDy07DwplCxvxevQVOtAsq+FZLQvWOhOJEcNMdVbdT3Li4McX/F2pzTiVq+XWFTEpme+AwEsecYESWrlAf5mV7PwlvX73CfQpN/ZXtu6yvU2bM74ggU4w6+OzZKSh/CuGOQgNOwCWO5xQxa6ioiGNebZtp4bvVqs/v4+I/7DeQoEbJngBDNvc+FWsDG+MTd7N6LZ9Tu/Zr0EwWg8rtOzr5VvptWNL5cFagqhaUFZGKuDSG8uY24hA0k9bAl+3S6z/ySn2nTkGdlFCGANgLx8/Bae4M20aWnEt0Sm2BYwuNTGpawXevnnFKV4Lvt6aDXMT23EIvLYUHbV6vHR7Hfn3VHgnIflZgdQtN1nXywsr3fXGsPGMitKi89ZeZw8hroq9V41NkHXX9kECGPJ53Z57UDQq6egKdwhgvnGg9Z6UguJsqBx8bb8Vm+hY3nbafn+P6/15uPLmF3iu5aRrpUquq/+eAJqHinHoS8ZfsAhdcW53kwwF9QzI45XqrYet7TbctYciHk6Uh++0of20tNRzA86WDz94J+qzezRTSA7Q2Ksdg35ACZKWeDM1TtkA3j3GPpI0QAsv9CuFPI2f2SCOrQdJgxTIx4Ficef7oRqxtfn1ecyWQ2dO/80US 7zIonCIs hGUxNYv92wOoXKi0ony0+CFDr9A/QLaPonfGIwqeELU7RkVvq3uZCfYfYjD5aXL3CtUTTirEC4He6UN4OYc/Zp0KfzrthPI2WUq5Rms72u4t5p3TuXRNygrC9jqoDd/UCUQhYjh4b4g67YIjAopWhLOvTPx/q/4KiC2Itbhr7+Cyt/rRmX/Z+vyBz4aTBz8oAWnleiM2dupM3RaCZIsHG15gpWv4C+QIcmQIPwpZuosooAd64ztKFmwN0VpLocqwStqUmHBcwj2gQ3CiBdaDyb8xfRyrUXM7muKm9 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 Wed, Apr 05, 2023 at 01:45:02PM +0100, Valentin Schneider wrote: > On 05/04/23 14:05, Frederic Weisbecker wrote: > > static void smp_call_function_many_cond(const struct cpumask *mask, > > smp_call_func_t func, void *info, > > @@ -946,10 +948,13 @@ static void smp_call_function_many_cond(const struct cpumask *mask, > > #endif > > cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE); > > if (llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu))) { > > - __cpumask_set_cpu(cpu, cfd->cpumask_ipi); > > - nr_cpus++; > > - last_cpu = cpu; > > - > > + if (!(scf_flags & SCF_NO_USER) || > > + !IS_ENABLED(CONFIG_GENERIC_ENTRY) || > > + ct_state_cpu(cpu) != CONTEXT_USER) { > > + __cpumask_set_cpu(cpu, cfd->cpumask_ipi); > > + nr_cpus++; > > + last_cpu = cpu; > > + } > > I've been hacking on something like this (CSD deferral for NOHZ-full), > and unfortunately this uses the CPU-local cfd_data storage thing, which > means any further smp_call_function() from the same CPU to the same > destination will spin on csd_lock_wait(), waiting for the target CPU to > come out of userspace and flush the queue - and we've just spent extra > effort into *not* disturbing it, so that'll take a while :( I'm not sure I buy into deferring stuff.. a NOHZ_FULL cpu might 'never' come back. Queueing data just in case it does seems wasteful.