Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6846104rdb; Fri, 15 Dec 2023 09:44:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEu3fNOiEw3Q/t+kUC4D8LMhl68R63V51kvpGMNj8Kgyp0eXLA3u+Zix4EectSN2bMfgD3m X-Received: by 2002:a17:907:31c3:b0:a19:a1ba:da2d with SMTP id xf3-20020a17090731c300b00a19a1bada2dmr7798409ejb.84.1702662265236; Fri, 15 Dec 2023 09:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702662265; cv=none; d=google.com; s=arc-20160816; b=wHWJq6ADrZtuNe3SV/lhXIsRF/s9OgqyxCK6gzEwaebvt8RS8MK51iAZ3IQbfUZ2jA g+yOrl2qwO+Kev+LzDtgi5bLDBMcr31ZA8NQaQutVtU2YxrzOC5kHQ9pstlbWM6Qsu+p bU7TN7iLwDzLbb36nzh7ajP6NAZE4nxKma/wIRu3gV9ZMXPDqZ0LbC+4ixsqAV7mf3fV YWSGj+ZdbQWaGqYT2L0HQiiAxDDzgCj9ZhSlyPNhEJc2khYp6BTuu86/qD6X2g3upSXv yeNUFvE9ZihdaxuNw+hXWedbyrFpWc4K1+PFNqAMhQSWKaUM9rmxYw69nera5rffTkXO xJKg== ARC-Message-Signature: i=1; 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:cc:to:from; bh=aCKV5F6vkTPhZ4h3/9Mwe5dE0a8ORoDinybnPL4CrE4=; fh=xjsbdB8NZJzbiqygyESgWUxyd4BI3/oiWXjD1LwrF60=; b=moj0IZSA8bGQwaPsLnT6d6y/pCcOp1K64LCPMVZDAYN1OnBh/TtvSTkfUk9gFY+V92 INLJy6FKDhb1VSK+M5WJmC5m5UinnGIbC51MKZ3RA+hR6sLk7+gSc/jV3ZiOVDbptKc4 fH2ZqaPd5eC6kabeboVurfsN29e2+61EiZlcoZM9/YxEzAkzEyDXM3vb21oorRm9uuLF /T8ogtS0nGbWMkq2mX+QVefcKI+3YkKtekDX0KAm3HaU3rbEAfHGZD7wnxncag6B8Dcs wOFKEEkKPWDK5Qo6XLHPAPPZ0GOc2cf2eYPUESROjWZbeakozgFMnbTWoC0ArYaGNLsO Zrig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dc3-20020a170906c7c300b00a22e6d46b01si3461384ejb.345.2023.12.15.09.44.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:44:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 am.mirrors.kernel.org (Postfix) with ESMTPS id B759D1F257BE for ; Fri, 15 Dec 2023 17:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F7DA3011F; Fri, 15 Dec 2023 17:44:08 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49AE630119 for ; Fri, 15 Dec 2023 17:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB0F21063; Fri, 15 Dec 2023 09:44:50 -0800 (PST) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB52C3F5A1; Fri, 15 Dec 2023 09:44:02 -0800 (PST) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, Frederic Weisbecker Subject: [PATCH v8 01/24] tick/nohz: Move tick_nohz_full_mask declaration outside the #ifdef Date: Fri, 15 Dec 2023 17:43:20 +0000 Message-Id: <20231215174343.13872-2-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231215174343.13872-1-james.morse@arm.com> References: <20231215174343.13872-1-james.morse@arm.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 tick_nohz_full_mask lists the CPUs that are nohz_full. This is only needed when CONFIG_NO_HZ_FULL is defined. tick_nohz_full_cpu() allows a specific CPU to be tested against the mask, and evaluates to false when CONFIG_NO_HZ_FULL is not defined. The resctrl code needs to pick a CPU to run some work on, a new helper prefers housekeeping CPUs by examining the tick_nohz_full_mask. Hiding the declaration behind #ifdef CONFIG_NO_HZ_FULL forces all the users to be behind an ifdef too. Move the tick_nohz_full_mask declaration, this lets callers drop the ifdef, and guard access to tick_nohz_full_mask with IS_ENABLED() or something like tick_nohz_full_cpu(). The definition does not need to be moved as any callers should be removed at compile time unless CONFIG_NO_HZ_FULL is defined. Signed-off-by: James Morse Tested-by: Shaopeng Tan Tested-by: Peter Newman Reviewed-by: Shaopeng Tan Acked-by: Reinette Chatre # for resctrl dependency CC: Frederic Weisbecker --- include/linux/tick.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 716d17f31c45..0fb903838dfb 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -164,9 +164,16 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } #endif /* !CONFIG_NO_HZ_COMMON */ +/* + * Mask of CPUs that are nohz_full. + * + * Users should be guarded by CONFIG_NO_HZ_FULL or a tick_nohz_full_cpu() + * check. + */ +extern cpumask_var_t tick_nohz_full_mask; + #ifdef CONFIG_NO_HZ_FULL extern bool tick_nohz_full_running; -extern cpumask_var_t tick_nohz_full_mask; static inline bool tick_nohz_full_enabled(void) { -- 2.20.1