Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2322771lqo; Mon, 13 May 2024 15:02:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPB4zKazVEqdPYw/lLlvT8U1bsnz0KYuusgMC27KReGVqXPZr70xCgwpBZe+5wQWklP4Sa97eMjAm61hyniRbFTtq2Lzz+T13y1kQ7lQ== X-Google-Smtp-Source: AGHT+IG0WlBeLxFA/0J1CAy+rR0DhgTjdq2nsGBcpv2uwVjcadXrqWFSLtvBDbHqRNBRy6MWaKZG X-Received: by 2002:a05:620a:5d90:b0:790:a508:ede0 with SMTP id af79cd13be357-792c75ff55emr1172457385a.64.1715637738427; Mon, 13 May 2024 15:02:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715637738; cv=pass; d=google.com; s=arc-20160816; b=W+deAD/4iSQdtomrr2cadna1fVk8vnKuMiqBDSJWGJM3RpIFnPftgwe4YDGacQDZPz sI4SbpTwjdFCngyZYL2lKDBpNGZbe2K4wqtmbuXOcbqfyYWsknZSp7ddN3Lb8dvgv1sX a1t709l2ODDcVY/NzdsSjpnnhiVuG920oFru8u2ia0hfRY8OMCUMon1w4Fa3+I23fdCh P/GrHjXh5eLLDYXIxgyMcgT/Zrxckyw8A/0G4bpQNEP7WNiUUDxf9mUeoSKClGOy/wT9 9XpV2mXYCsEuWcrBM+cRO8idbQCa2FCoX8DgzmYFwZPvc/CxZ7ogXTToxkUToYmqfzvI T/PA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=6JSD1LqLj1PrAOr7CV2jbwc/Cer/cuXBqiOk+ZKJvmI=; fh=v36na2g36tOcJlT5uxbT3bvcl5NFRUl6Y3dPr2/SD14=; b=AQjjFZ3n/3h1nxDAs6iRce3QkT7/sHU7Hcg3bRLdafshFjNbutnkRiIu8/l20vB3iG rtKvx60BCSIylhoa5RvW9LZGE80PRjBmCWpugrJ93yBFEUt43lae0SOwUZsbNu/kVdRW oZC38TWqmCG3T3ltUZPRUj3/f5FkWSY9uhff0bc5DnQNnypV8XUu0e3GByQlMbZVvfrL AS/CxMyCq1dwRS3edMQki0vl7N0E1ixL/vl8PSgVpY3WFzSvwR4kcT1BQR5iVMRKmb5G QQIyjf4H7nd8FZ03+NTePUvkON6qQ3tIEjgUVf086RQXewjSciLJq7FmnjtjsHvxsXC5 qRCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QUd+97EZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178125-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b6ddsi1014367485a.234.2024.05.13.15.02.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QUd+97EZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178125-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F41FA1C20E68 for ; Mon, 13 May 2024 22:02:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D51F84DF4; Mon, 13 May 2024 22:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QUd+97EZ" Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FADD84A4D; Mon, 13 May 2024 22:01:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637714; cv=none; b=YxKlz4rNEa8xWWQdCBgFHHxAyI+d+lF95WxKItdlkADaQ7SjDyuw72JT0G0vBcrvUqCzPamUr5eEO6H3MuaYTquVpXRIlw5/TRW0yDopPwV52R7vNxKjzw94rC0wt7j1Qvs497n6T4Ru4lBtNfgNn9IUh1b/d69ICFTRogxmSoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637714; c=relaxed/simple; bh=XTEmg/hS44058q8iEC2rDiZ6UxIXdT7is3pHwul7Rbc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CKHW06H6ZteBawkxOaQq7mgtIbxJ8qeyod7i8AZ9kSoRt+MocqN4ilZBX9rXgcDe2pJrmxD51JLK4TjvkzzRQAKyz6YKbPjYmBuAYR15YcnhOHLruAd9rjM0NOFtm9ibsKSKy25/6AFheeLXsMb8FnKFHjFD4BBwY8ItuyKS/dQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QUd+97EZ; arc=none smtp.client-ip=209.85.128.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-62036051972so54620657b3.1; Mon, 13 May 2024 15:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715637712; x=1716242512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6JSD1LqLj1PrAOr7CV2jbwc/Cer/cuXBqiOk+ZKJvmI=; b=QUd+97EZzoMSeHzZjdCt2CXstuKRk7H3F/3UwkdQG3pane+yJ81kkOsgM6C2tUDJAx wlUrqwY8U0OmV4QaJDHSbYrUWAf5m0MVBSU6eWQkYOoKzp2hmeZOG6k0Oea985ZgU+2R Eg5xCCyif/sAruX12wKhwm9YB6xRVHO7IkOzl9wrotfaND6C9a8lZ1CdcLgavID5WinO U2rHX6e0Xn3CUTm2N5bbGR2x+FqEXV4g39egTBbBFh9ijogNfJ0R/7sfVrQq/MoTx2z5 vf1wsf6eC5N7GlhAabchAmyWFXSuLIZib35iy8HmMAGW2w+M3+WEsugMXh9hu1xSo6Wy llQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715637712; x=1716242512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6JSD1LqLj1PrAOr7CV2jbwc/Cer/cuXBqiOk+ZKJvmI=; b=Bk8LirZF3mr9vMLvtdX4Tn1HbKRakhYzSIp6zqg8tXUhSfiUryxcc6OhzB9U4gZUNS gFSRZiEmA1aYRdRISskXQQpRi/+FXCAThKtt1SonQhNw0jsDD/TuDdndVCNdp/8JUafD 2nJcSZ14NuvC+ZtJsqrol1SomOsKIZjVwEr1i2snljY2G7A6RzI7vwUN3s5XVxcbbFZ/ WQKxolUyiaeHzUdoA5AK4OBw4hczrwpT70D2Ro3b6rIfOxR+ajEOjFBT5i4benT5yzTL 8vydU4k8S03dFWgxWcJ1oUs/B1Rvy4MjEiX1jV7Q/UuoihtB8Oq8z9LY9CzPKOnaa0mH T8Fg== X-Forwarded-Encrypted: i=1; AJvYcCWK1R7cc4x8vNd/pnlQ1QvMYbPA6+11bRA55hIVanwZjv81Zcpl2v1f2hBL5n3FISga4w1xRpmOpYFGklvDe8IW3gsiaZCqKQ== X-Gm-Message-State: AOJu0YyPf/rn30fR+TdgglT6d3++HSpl1YhCz0KuIUX4UCzchAUC7dTe 52WCANdo4frfog4JJ+RoPF6QKnsM47QSrmLUbJl7MfRkYXdw9YBVbxCNbg== X-Received: by 2002:a05:690c:6610:b0:618:91a0:70f with SMTP id 00721157ae682-622affa592bmr124005737b3.6.1715637711467; Mon, 13 May 2024 15:01:51 -0700 (PDT) Received: from localhost ([2601:344:8301:57f0:8acf:1c06:973:d499]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6209e37952csm23253027b3.118.2024.05.13.15.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:01:51 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Paul E. McKenney" , "Rafael J. Wysocki" , Anna-Maria Behnsen , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Frederic Weisbecker , Imran Khan , Ingo Molnar , Johannes Weiner , Juri Lelli , Leonardo Bras , Mel Gorman , Peter Zijlstra , Rik van Riel , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Waiman Long , Yury Norov , Zefan Li , cgroups@vger.kernel.org Subject: [PATCH 1/6] smp: optimize smp_call_function_many_cond() Date: Mon, 13 May 2024 15:01:41 -0700 Message-Id: <20240513220146.1461457-2-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240513220146.1461457-1-yury.norov@gmail.com> References: <20240513220146.1461457-1-yury.norov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The function may be called with mask == cpu_online_mask, and in this case we can use a cheaper cpumask_cooy() instead of cpumask_and(). Signed-off-by: Yury Norov --- kernel/smp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/smp.c b/kernel/smp.c index f085ebcdf9e7..6f41214a1b54 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -798,7 +798,10 @@ 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, mask); + else + cpumask_and(cfd->cpumask, mask, cpu_online_mask); __cpumask_clear_cpu(this_cpu, cfd->cpumask); cpumask_clear(cfd->cpumask_ipi); -- 2.40.1