Article View: linux.kernel.netdev
Article #24349[RFC PATCH 02/10] sched/isolation: Add runtime isolation helpers
From: Kris Pan
Date: Mon, 30 Nov 2026 03:37
Date: Mon, 30 Nov 2026 03:37
104 lines
13380 bytes
13380 bytes
cpuset isolated partitions update HK_TYPE_DOMAIN at runtime.
HK_TYPE_DOMAIN_BOOT still reflects only boot-time isolcpus=domain
CPUs, so the difference is exactly the set isolated at runtime.
Expose housekeeping_runtime_isolated(), a scratch-free CPU test and a
runtime-only intersection helper in <linux/sched/isolation.h>. The
helpers read the existing housekeeping masks under RCU and do not
change boot-time IRQ semantics. RCU_LOCKDEP_WARN() catches a caller
which forgets the RCU read lock when CONFIG_PROVE_RCU is enabled.
Signed-off-by: Kris Pan <kris.pan@intel.com>
---
include/linux/sched/isolation.h | 32 ++++++++++++++++++++++++++++++++
kernel/sched/isolation.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index ae5109450ac92..cec4e051dfab9 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -77,6 +77,38 @@ static inline void housekeeping_set_cpu(int cpu, enum hk_type type) { }
static inline void housekeeping_init(void) { }
#endif /* CONFIG_CPU_ISOLATION */
+#ifdef CONFIG_CPU_ISOLATION
+/*
+ * Runtime-only isolated CPUs.
+ *
+ * DOMAIN_BOOT excludes boot-time isolcpus=domain CPUs and DOMAIN further
+ * excludes runtime cpuset isolated CPUs. The difference is therefore the
+ * runtime PRS_ISOLATED set, without changing boot IRQ semantics.
+ *
+ * All three helpers below must be called under RCU read lock.
+ */
+void housekeeping_runtime_isolated(struct cpumask *out);
+bool housekeeping_runtime_isolated_cpu(unsigned int cpu);
+bool housekeeping_runtime_isolated_intersects(const struct cpumask *mask);
+
+#else
+static inline void housekeeping_runtime_isolated(struct cpumask *out)
+{
+ cpumask_clear(out);
+}
+
+static inline bool housekeeping_runtime_isolated_cpu(unsigned int cpu)
+{
+ return false;
+}
+
+static inline bool
+housekeeping_runtime_isolated_intersects(const struct cpumask *mask)
+{
+ return false;
+}
+#endif /* CONFIG_CPU_ISOLATION */
+
static inline bool housekeeping_cpu(int cpu, enum hk_type type)
{
#ifdef CONFIG_CPU_ISOLATION
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index c0c8b8862cbdc..418579766a364 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -131,6 +131,37 @@ void __init housekeeping_set_cpu(int cpu, enum hk_type type)
cpumask_set_cpu(cpu, housekeeping_cpumask_dereference(type));
}
+void housekeeping_runtime_isolated(struct cpumask *out)
+{
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
+ "runtime isolation mask needs RCU read lock");
+ cpumask_andnot(out, housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT),
+ housekeeping_cpumask(HK_TYPE_DOMAIN));
+}
+
+bool housekeeping_runtime_isolated_cpu(unsigned int cpu)
+{
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
+ "runtime isolation CPU test needs RCU read lock");
+ return cpumask_test_cpu(cpu, housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT)) &&
+ !cpumask_test_cpu(cpu, housekeeping_cpumask(HK_TYPE_DOMAIN));
+}
+
+bool housekeeping_runtime_isolated_intersects(const struct cpumask *mask)
+{
+ const struct cpumask *boot = housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT);
+ const struct cpumask *dom = housekeeping_cpumask(HK_TYPE_DOMAIN);
+ unsigned int cpu;
+
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
+ "runtime isolation intersection needs RCU read lock");
+ for_each_cpu_and(cpu, mask, boot) {
+ if (!cpumask_test_cpu(cpu, dom))
+ return true;
+ }
+ return false;
+}
+
int housekeeping_update(struct cpumask *isol_mask)
{
struct cpumask *trial, *old = NULL;
--
2.43.0
Technical Details
Message-ID:
<20261130033709.2704805-3-kris.pan@intel.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373815-linux-kernel-netdev=dewy.ruReferences:
<20261130033709.2704805-1-kris.pan@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373815-linux-kernel-netdev=dewy.ru From: kris.pan@intel.com (Kris Pan) Newsgroups: linux.kernel.netdev Subject: [RFC PATCH 02/10] sched/isolation: Add runtime isolation helpers Date: Mon, 30 Nov 2026 11:37:00 +0800 Organization: Usenet Network Message-ID: <20261130033709.2704805-3-kris.pan@intel.com> References: <20261130033709.2704805-1-kris.pan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1323465"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kXdd5H8UhxbAWxCl7ibkdIkfP0I= sha256:1ZousAZkLHdbbzGF86XzezKnbsG+zdeo3mMCfDksIgg= sha1:W1MV3Wz8MHlGoxlGZH1qK0oBLos= sha256:Df9qyAB2cliRcw7nRjDFY5a8IqNiL4XYelvgoOljIQ4= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8B189125FB2; Mon, 30 Nov 2026 06:40:55 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.152 X-Spam-Status: No, score=-3.152 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k6RcSmU_K4Ov; Mon, 30 Nov 2026 06:40:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-373815-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id D7DBD125F08; Mon, 30 Nov 2026 06:40:44 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id C32DB60078B; Mon, 30 Nov 2026 03:40:43 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796010039; b=s6gZ3sw2mt/2JiaHhUpdtEoCATj5QYtGyW5TO7PcaJiKqzitf6S3bj1g2q8gGvy+D0ZS Whi7kkGQzLUa4anOYOtExLXongwv8njYh9iwYReAha7uWQIIj4MqQSqg87f4c5o9zfPTZ xJSR3V+i8vC4OLnabSS0F/UjF9n9r6doUsdU19de+8rhq4GU9SaWwoQRnfRiAD7WZqBKJ 62X9wGArH1pNEBrdX+VReXT/buXVIqw+e34rDPUdjQDj3kPzpu3bTIQUQmgkj5d2pJyjn uhDI097wJnpLZVrK9jXty/fSeaMRpyo22Rp9gL6zTgQDJqin09OYd1MjYyBf35OvF2Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796010039; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=tr9GkDYtYy57kgbcP8L4YyxEEkTAoY0QE7m4YNvIfaA=; b=XJ/DkWlQew1Juk2XLasVHKQK3axiaocbzyKUEqJ0e314vUfRbNJkRGdpWTiJbyA9On9I hFvYH0BvNif74pwiWeLzIBFOIJXaCRLMfa4Xac3VaYND4zcNUn4yF/s97YNC6U+3CjJkL kTG9IO070VzkfnuH1CpWgHUi4Rua2n6lRJZmQ1X7X57k2S58NLF7XzuOjB8/NawbsF/16 beF91kiOBVWbpnDxTs80v1f8K7HE9A1CxZuSwgG9pm8DaSqQJOWhGRBsNLZoSTdFH6mQP xEgUru83lw0LznX1C81ujhcHx6Sj2EFuNWAYO/sjhcbFPey04s4jLDWwLdgMuNj1Qqw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=biPZBH6M; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5140606A68C; Mon, 30 Nov 2026 03:40:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=biPZBH6M X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.19 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796010029; b=1SBlUbFr0llBS2niwj+Q2SxHVSjWR8klajFlocDTIsY0vIy4X/G1MI0WPwm8yvQmiz2Y TJHc0W/iCvusyO6B4q7ZOTs0cKtGqPenEY8Hxq6oFseGgo5wn87s4+2VCkDdiZg+galdL nTXlz4oJNdWBQimmT1AlcEPK0aDQFQ6LHa2wdLS3l6elvTHbzt3aq1xSF4zuiQHBuA15o 9EzW9A3HR982KnjOzZXo8pZEPbLzp5CB+eRZrC7yR6EDqflgqF7A+k0IX5wbRPmzAiiC/ ZoLSmJsEtJYGjsW6EAc8NjPSTv7V5hELBNNezNdpB+raULOcwTbhpMCJp4Z7tccuYGA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796010029; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=tr9GkDYtYy57kgbcP8L4YyxEEkTAoY0QE7m4YNvIfaA=; b=zSnG3eVippnAHRK1UP44aWrGPjKG7ODZU9z3A3Ohgt4Eny3Y8wxyRZgDKF0mOw/v0kGf iqC+klh9RPAAw2cA6cm+PZa/h4PUMSg4QpzaZjw3rkJPTR5rJ+dhGVomkU+4A9QTYgugM k/Z/mcXsu6Y/TAm9bI8m9Ua87svmGgTNLDoDs9Yf2cvwjE8sGk073fxEQVqwGFPK45rIy j3Rah+BUnhQ5aSslKCv+l/7uesa8Yt/8hVpojYp7jA2JsE87mOfwnD6/Xi3UXvBEGxFFX V1gUzbNBlNOA3UIGUc4fCX+0DwvzofgB/Uiwq3Kd1kK3ozeyOTX3LmmGJyPWCCk+epQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=biPZBH6M; arc=none smtp.remote-ip=192.198.163.19 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42672606A32C; Mon, 30 Nov 2026 03:40:28 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 42672606A32C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796010028; x=1827546028; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TXmnpGqPq3cJUs7XPjmxUnEexeW0EcDT1EilZmiwrPg=; b=biPZBH6McGQz7MFISVgjJTa79a/JvKi6WBJCPWOEVnsqiXyT6pvatB/v ncdsrJwNh8d9vAxjCWyN/s6paJNAVVal0unRGz7lZB2/ihEhL9Isj+AmV ftcs+NYzt7NTn/namt0CDsKt9bFVN5g0P3+ZcwxELrBZfVOtks0wT6dnQ KnzBHFJgcmTNrJ2liSxT+rXTN+oU0wVg5dmswIO6tgE5skykYgm+72PDO Krjkf7NaGS+MJ32RG5fj3KXEnQV5M7iorP4FqAcWLP64/rUgocusU1mw9 FBXzH4cJKgDtweg26PyZJ2WaW0SahUjTQ/AzmuQ8k97MoiTVzj/9cg0wN g==; X-CSE-ConnectionGUID: ncdO9UP2SfSE0nQuecn5sA== X-CSE-MsgGUID: cq2Nml1SS9a+H/9HC0sAag== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4848248" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4848248" X-Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 19:40:27 -0800 X-CSE-ConnectionGUID: cs3XxufqR7unruh8lxTR6A== X-CSE-MsgGUID: Resk3fOFSXefZEkZHNoiiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="12950999" X-Received: from pankris-x299-ud4-pro.bj.intel.com ([10.238.152.122]) by fmviesa005.fm.intel.com with ESMTP; 29 Nov 2026 19:40:19 -0800 X-Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, x86@kernel.org, peterz@infradead.org, frederic@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, longman@redhat.com, tj@kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, linux-hyperv@vger.kernel.org, bhelgaas@google.com, lpieralisi@kernel.org, linux-pci@vger.kernel.org, steve.wahl@hpe.com, bigeasy@linutronix.de, clrkwllms@kernel.org, linux-rt-devel@lists.linux.dev, radu@rendec.net, linux-kernel@vger.kernel.org, Kris Pan <kris.pan@intel.com> X-Mailer: git-send-email 2.43.0 X-In-Reply-To: <20261130033709.2704805-1-kris.pan@intel.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list