Message ID | 20231215174343.13872-2-james.morse@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-1440-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9456282dys; Fri, 15 Dec 2023 09:44:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFn4ClSRT0PtBwfMkqr5hky/PO4/Wrr9alwm6aO/BbWaDWfCQZ0Voe+gTy6We+P8P1Ll95/ X-Received: by 2002:a17:906:73cd:b0:a19:d66d:dc60 with SMTP id n13-20020a17090673cd00b00a19d66ddc60mr6748747ejl.67.1702662273851; Fri, 15 Dec 2023 09:44:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702662273; cv=none; d=google.com; s=arc-20160816; b=yStHd4Icyzd9djVfAA5ABYy4p7pnyiiEfcRSRKoyKcbn7FHJE1S6zWoU20rU5NNU2B 98rwkTf2sKkdGxZQtlcOJR9db/fpNJwngPpOOjtD12aqU542a+ZVgoaf26gM1bzRKIjc zL3/OCN4tgu8CDz1NnJtInGXvdcVbhVYDDcvk+NgdAU7gqcb+98j72Up17E45/iGwFS5 kJ/IfPEz8TN6drrn/yQsLm8lnx7cXIeqdkEH/9gjoWMixNefPbaDyPc2o7vTb6cQE2mn Y25q3nBC5ASVI/vM+/fx8viasjnb/x0wME7fq61Ked4vzZWCkBpc+5tgLE9YVUQaVAoX +AeA== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e15-20020a1709067e0f00b00a231d3912f5si463650ejr.771.2023.12.15.09.44.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:44:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1440-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1440-ouuuleilei=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 7722A1F2415F for <ouuuleilei@gmail.com>; Fri, 15 Dec 2023 17:44:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60BB830133; Fri, 15 Dec 2023 17:44:09 +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 <linux-kernel@vger.kernel.org>; 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 <james.morse@arm.com> To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu <fenghua.yu@intel.com>, Reinette Chatre <reinette.chatre@intel.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, H Peter Anvin <hpa@zytor.com>, Babu Moger <Babu.Moger@amd.com>, James Morse <james.morse@arm.com>, shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS <scott@os.amperecomputing.com>, carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles <quic_jiles@quicinc.com>, Xin Hao <xhao@linux.alibaba.com>, peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, Frederic Weisbecker <frederic@kernel.org> 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785370796302034369 X-GMAIL-MSGID: 1785370796302034369 |
Series |
x86/resctrl: monitored closid+rmid together, separate arch/fs locking
|
|
Commit Message
James Morse
Dec. 15, 2023, 5:43 p.m. UTC
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 <james.morse@arm.com> Tested-by: Shaopeng Tan <tan.shaopeng@fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@fujitsu.com> Acked-by: Reinette Chatre <reinette.chatre@intel.com> # for resctrl dependency CC: Frederic Weisbecker <frederic@kernel.org> --- include/linux/tick.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Comments
On Fri, Dec 15 2023 at 17:43, James Morse wrote: > 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. I can pick that up separately, but I'm fine when it goes with the resctrl lot. For that case: Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Hi Thomas, On 15/12/2023 20:31, Thomas Gleixner wrote: > On Fri, Dec 15 2023 at 17:43, James Morse wrote: >> 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. > I can pick that up separately, but I'm fine when it goes with the > resctrl lot. For that case: > Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Thanks! James
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) {