Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3804730imw; Mon, 18 Jul 2022 15:01:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t//eJD5wiyCg2shXTSesQTMTl80kWRMrJfUlMH1RnyPpbBT4PhMV0L5akuTB/rcOiwoKGS X-Received: by 2002:a05:620a:f0d:b0:6a9:b3e9:dc3f with SMTP id v13-20020a05620a0f0d00b006a9b3e9dc3fmr18677905qkl.437.1658181673452; Mon, 18 Jul 2022 15:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658181673; cv=none; d=google.com; s=arc-20160816; b=a2tHww+l5Y+cW9ZqSlMdl34L4qJuaXoMqmwZe+4MaVMaVh0naFoSRkc0NeGadk4UYZ HB1SZJCAke6qWVihzw79JQYiuWy17wVgTJLTfwmeTEz6pVCXNUAMlUCQax1zQJRjY9W2 ryFb/0MvSW/uohyB3/7/RedZf6T+NAE9in1HDcAxmEVHoJzdM1uK7ilVyzJh7D3fpm6I EX4ri/9PRKKKR6TPXomeuuJD7GKVXuIH0k/2HDrqG8vdKPpQ5f/P5a2adnLM4hSJ1Fz0 6Llwum3jUHhW1qFB/GfjTJFIzMTtvCxxpQDi5UxIGDimiSo8pOXpDlcQvILd9LiA0iY6 3zsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MAAgRXyGRUBm6HRgIN7nuvuw3aye3x5SdOQNP5jLmJs=; b=fGLwo/QFRw7WYDnFMQ51bS9/2ySKkYsnzHUMMIGamRIifgzhb+/OGDrufM59gMoG5s gNvuqJqelmowJa4X97cBh78Ihuy0zkJLvq0splCZ2bL5S4sA16xxzkIKItoYtgxlk7Aj /1RNne/lNqqw5/h5oSMsvp5J32aDY9izx9Yk+bQ2rGMeruaZ3AFGqY2J4ad4d/dR6h0J 7otucjL0yqK+cZdz9vnhC2hOMIW7q+2/A/7bapgLzc6r1x4nTOSNqdRJaqAc/yhvLBGp qu3YSdocdTjs4yTwLEIgmfpuCdQRBHZQt077ZcAPXEg8NISFETrJf0+qgrqyFDpRpDWc DdZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PAablPLL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gm8-20020a056214268800b00473038d5593si6779666qvb.403.2022.07.18.15.00.58; Mon, 18 Jul 2022 15:01:13 -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=@infradead.org header.s=casper.20170209 header.b=PAablPLL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbiGRVaH (ORCPT + 99 others); Mon, 18 Jul 2022 17:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232002AbiGRV3p (ORCPT ); Mon, 18 Jul 2022 17:29:45 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660A929C85; Mon, 18 Jul 2022 14:29:44 -0700 (PDT) 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=MAAgRXyGRUBm6HRgIN7nuvuw3aye3x5SdOQNP5jLmJs=; b=PAablPLLkltxvc9MCZh8AxhzJo 96EgOIXX0Qr+GdNNwNtvi3qZ8/kAJaYXV27egcjzp4r6GUBxJ1SDanbq/Y/LuWaGkIRLxJ6uA7eNs eipDG7QRQS+zlV/x3Kp+ROrBIouY/vp/QCuwsthr69l1EFd9Jogq0tfS2VepaKg3qz7+tNsKNEWqR aIFouCVfb9fx84FGmKbo9yr23x4byXfrBHp9qH2wO4Ld3q4Zh6nI0IJ4T/IKIanZNVI97z2KKtfCB 3bVL2y4Dl7lI0ZIVmG1EqVm5a+zBbGkuKTFIYk3tdchaVDNhUFVbFmNPeDVacoK/kWXJtxZcYX4Fe fvJoMeeA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDYId-00D2zy-6h; Mon, 18 Jul 2022 21:29:07 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id C42009802A7; Mon, 18 Jul 2022 23:29:06 +0200 (CEST) Date: Mon, 18 Jul 2022 23:29:06 +0200 From: Peter Zijlstra To: Yury Norov Cc: linux-kernel@vger.kernel.org, Alexander Lobakin , Alexei Starovoitov , Alexey Klimov , Andrew Morton , Andrii Nakryiko , Andy Shevchenko , Ben Segall , Christoph Lameter , Dan Williams , Daniel Borkmann , Daniel Bristot de Oliveira , Dennis Zhou , Dietmar Eggemann , Eric Dumazet , Frederic Weisbecker , Guenter Roeck , Ingo Molnar , Isabella Basso , John Fastabend , Josh Poimboeuf , Juergen Gross , Juri Lelli , KP Singh , Kees Cook , Martin KaFai Lau , Mel Gorman , Miroslav Benes , Nathan Chancellor , "Paul E . McKenney" , Randy Dunlap , Rasmus Villemoes , Sebastian Andrzej Siewior , Song Liu , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Vlastimil Babka , Yonghong Song , linux-mm@kvack.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH 08/16] smp: optimize smp_call_function_many_cond() for more Message-ID: References: <20220718192844.1805158-1-yury.norov@gmail.com> <20220718192844.1805158-9-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220718192844.1805158-9-yury.norov@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Mon, Jul 18, 2022 at 12:28:36PM -0700, Yury Norov wrote: > --- > kernel/smp.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/kernel/smp.c b/kernel/smp.c > index 7ed2b9b12f74..f96fdf944b4a 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -942,7 +942,11 @@ static void smp_call_function_many_cond(const struct cpumask *mask, > > if (run_remote) { > cfd = this_cpu_ptr(&cfd_data); > - cpumask_and(cfd->cpumask, mask, cpu_online_mask); > + if (mask == cpu_online_mask) > + cpumask_copy(cfd->cpumask, cpu_online_mask); > + else > + cpumask_and(cfd->cpumask, mask, cpu_online_mask); > + Or... you could optimize cpumask_and() to detect the src1p == src2p case? > __cpumask_clear_cpu(this_cpu, cfd->cpumask); > > cpumask_clear(cfd->cpumask_ipi); > -- > 2.34.1 >