Skip to contentSkip to conversation

Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI)

RFC PATCH In review Qiliang Yuan 5 participants 19 messages Feb 6 – Feb 20

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI)

The Linux kernel provides mechanisms like 'isolcpus' and 'nohz_full' to reduce interference for latency-sensitive workloads. However, these are locked behind the "Reboot Wall" - they can only be configured via boot parameters and require a system restart to change.

*** THIS IS AN RFC ***
This series is being submitted as an Request For Comments to discuss the architectural changes required to support dynamic reconfiguration of housekeeping boundaries. Key points for discussion:
- The use of a blocking notifier chain for cross-subsystem synchronization.
- Compatibility with existing boot-time isolcpus and nohz_full parameters.
- User-space sysfs interface design for granular isolation control.

While cgroup2 (cpuset) provides task-centric resource partitioning (including unbound kthreads), it lacks the infrastructure to reconfigure core kernel subsystems or manage per-CPU kernel activities. Specifically, cgroups cannot:
- Managed interrupt (IRQ) migration.
- RCU callback offloading and grace-period kthread placement.
- Per-CPU kernel threads (e.g., watchdog/n) and global subsystem logic (e.g., kcompactd).
- Subsystem-level masks for unbound workqueues.
- Dynamic toggling of full dynticks (NOHZ_FULL) mode.

This patch series introduces Dynamic Housekeeping & Enhanced Isolation (DHEI). DHEI allows administrators to reconfigure the kernel's housekeeping boundaries at runtime via a new sysfs interface at /sys/kernel/housekeeping/.

Core Architecture:
1. Notifier-Driven Synchronization: A new blocking notifier chain (HK_UPDATE_MASK) allows isolation.c to signal all participating subsystems (IRQ, RCU, Sched, Watchdog, Workqueue, kcompactd, Tick) whenever a housekeeping mask is modified.
2. Decoupled Memory Management: Replaced boot-time memory allocators with runtime-safe variants, allowing masks to be allocated or resized after the system is running.
3. Subsystem Handlers: Each critical subsystem implements a reconfiguration handler to migrate pending work, re-affine kthreads, or re-route interrupts dynamically.

Key Features:
- Fine-grained control: Separate sysfs nodes for timer, rcu, tick, workqueue, kthread, etc.
- Dynamic NOHZ_FULL: Supports enabling/disabling full dynticks mode on-the-fly by re-kicking CPUs to evaluate tick dependencies.
- SMT Awareness: An optional 'smt_aware_mode' ensures that all SMT siblings of a physical core stay in the same isolation state.
- Safety Guard: Prevents the isolation of all CPUs, ensuring at least one online CPU is always available for housekeeping tasks.

This series provides the necessary infrastructure for cloud-native orchestrators and high-frequency trading platforms to dynamically re-partition CPU resources without incurring the downtime of a reboot.

---
Qiliang Yuan (12):
sched/isolation: Remove __init restriction from housekeeping cores sched/isolation: Introduce reconfiguration notifier chain
genirq: Implement dynamic migration for Managed IRQs
rcu: Sync RCU housekeeping mask on notification sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN)
watchdog: Allow runtime toggle of hardlockup detector on CPUs
workqueue: Dynamic housekeeping mask update support
kcompactd: Add housekeeping notifier for dynamic mask update sched/isolation: Separate housekeeping types and add sysfs interface tick/nohz: Implement dynamic nohz_full state update sched/isolation: Implement SMT sibling auto-isolation and safety check sched/isolation: Bridge isolcpus and support runtime tick offload init

 include/linux/sched/isolation.h |  40 +++++--
 include/linux/tick.h            |   2 +-
 kernel/irq/manage.c             |  52 +++++++++
 kernel/rcu/tree.c               |  43 +++++++
 kernel/sched/core.c             |   5 +-
 kernel/sched/isolation.c        | 252 ++++++++++++++++++++++++++++++++++++++--
 kernel/sched/sched.h            |   2 +-
 kernel/sched/topology.c         |  26 +++++
 kernel/time/tick-sched.c        |  63 +++++++++-
 kernel/watchdog.c               |  24 ++++
 kernel/workqueue.c              |  39 +++++++
 mm/compaction.c                 |  26 +++++
 12 files changed, 547 insertions(+), 27 deletions(-)

---
base-commit: 1f97d9dcf53649c41c33227b345a36902cbb08ad
change-id: 20260206-feature-dynamic_isolcpus_dhei-ee46b6e3a477

Best regards,

Signature · 1 line
Qiliang Yuan <[email protected]>
#1 lore raw

RFC PATCH 1/12 sched/isolation: Remove __init restriction from housekeeping cores

The current housekeeping management logic in kernel/sched/isolation.c is heavily tied to the boot process. Functions like housekeeping_setup() and housekeeping_init() are marked with __init, and they use alloc_bootmem_cpumask_var() for memory allocation. This prevents any runtime reconfiguration of housekeeping masks.

Refactor the infrastructure to support dynamic updates:
1. Remove __init markers from core functions to keep them available after boot.
2. Replace bootmem allocation with runtime-safe alloc_cpumask_var() using appropriate GFP flags (GFP_NOWAIT during early boot, GFP_KERNEL at runtime).
3. Introduce housekeeping_mutex to protect the global state during concurrent updates.
4. Update include/linux/sched/isolation.h to reflect function signature changes.

This lays the foundation for runtime isolation reconfiguration without requiring a system reboot.

---
 include/linux/sched/isolation.h |  2 +-
 kernel/sched/isolation.c        | 32 ++++++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 9 deletions(-)
include/linux/sched/isolation.h +1 -1
index d8501f4709b5..cecb80b09120 100644
@@ -31,7 +31,7 @@ extern const struct cpumask *housekeeping_cpumask(enum hk_type type);
 extern bool housekeeping_enabled(enum hk_type type);
 extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
 extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
-extern void __init housekeeping_init(void);
+extern void housekeeping_init(void);
 
 #else
 
kernel/sched/isolation.c +24 -8
index 3ad0d6df6a0a..811bf6cbe68d 100644
@@ -8,6 +8,7 @@
  *
  */
 #include <linux/sched/isolation.h>
+#include <linux/mutex.h>
 #include "sched.h"
 
 enum hk_flags {
@@ -16,6 +17,7 @@ enum hk_flags {
 	HK_FLAG_KERNEL_NOISE	= BIT(HK_TYPE_KERNEL_NOISE),
 };
 
+static DEFINE_MUTEX(housekeeping_mutex);
 DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
 EXPORT_SYMBOL_GPL(housekeeping_overridden);
 
@@ -84,7 +86,7 @@ bool housekeeping_test_cpu(int cpu, enum hk_type type)
 }
 EXPORT_SYMBOL_GPL(housekeeping_test_cpu);
 
-void __init housekeeping_init(void)
+void housekeeping_init(void)
 {
 	enum hk_type type;
 
@@ -102,20 +104,30 @@ void __init housekeeping_init(void)
 	}
 }
 
-static void __init housekeeping_setup_type(enum hk_type type,
+static void housekeeping_setup_type(enum hk_type type,
 					   cpumask_var_t housekeeping_staging)
 {
+	unsigned int gfp = GFP_KERNEL;
+
+	if (system_state < SYSTEM_RUNNING)
+		gfp = GFP_NOWAIT;
+
+	if (!housekeeping.cpumasks[type])
+		alloc_cpumask_var(&housekeeping.cpumasks[type], gfp);
 
-	alloc_bootmem_cpumask_var(&housekeeping.cpumasks[type]);
 	cpumask_copy(housekeeping.cpumasks[type],
 		     housekeeping_staging);
 }
 
-static int __init housekeeping_setup(char *str, unsigned long flags)
+static int housekeeping_setup(char *str, unsigned long flags)
 {
 	cpumask_var_t non_housekeeping_mask, housekeeping_staging;
 	unsigned int first_cpu;
 	int err = 0;
+	unsigned int gfp = GFP_KERNEL;
+
+	if (system_state < SYSTEM_RUNNING)
+		gfp = GFP_NOWAIT;
 
 	if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE)) {
 		if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) {
@@ -125,13 +137,17 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
 		}
 	}
 
-	alloc_bootmem_cpumask_var(&non_housekeeping_mask);
+	if (!alloc_cpumask_var(&non_housekeeping_mask, gfp))
+		return 0;
+
 	if (cpulist_parse(str, non_housekeeping_mask) < 0) {
 		pr_warn("Housekeeping: nohz_full= or isolcpus= incorrect CPU range\n");
 		goto free_non_housekeeping_mask;
 	}
 
-	alloc_bootmem_cpumask_var(&housekeeping_staging);
+	if (!alloc_cpumask_var(&housekeeping_staging, gfp))
+		goto free_non_housekeeping_mask;
+
 	cpumask_andnot(housekeeping_staging,
 		       cpu_possible_mask, non_housekeeping_mask);
 
@@ -203,9 +219,9 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
 	err = 1;
 
 free_housekeeping_staging:
-	free_bootmem_cpumask_var(housekeeping_staging);
+	free_cpumask_var(housekeeping_staging);
 free_non_housekeeping_mask:
-	free_bootmem_cpumask_var(non_housekeeping_mask);
+	free_cpumask_var(non_housekeeping_mask);
 
 	return err;
 }
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores

kernel test robot noticed the following build warnings:

Hi Qiliang,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:

[auto build test WARNING on 1f97d9dcf53649c41c33227b345a36902cbb08ad]

url:    https://github.com/intel-lab-lkp/linux/commits/Qiliang-Yuan/sched-isolation-Remove-__init-restriction-from-housekeeping-cores/20260206-150801
base:   1f97d9dcf53649c41c33227b345a36902cbb08ad
patch link:    https://lore.kernel.org/r/20260206-feature-dynamic_isolcpus_dhei-v1-1-00a711eb0c74%40gmail.com
patch subject: [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores
config: arc-randconfig-002-20260208 (https://download.01.org/0day-ci/archive/20260208/[email protected]/config)
compiler: arc-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260208/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from kernel/sched/build_utility.c:101:
kernel/sched/isolation.c: In function 'housekeeping_setup_type':

>> kernel/sched/isolation.c:115:13: warning: the comparison will always evaluate as 'true' for the address of 'cpumasks' will never be NULL [-Waddress]
     115 |         if (!housekeeping.cpumasks[type])
         |             ^
   kernel/sched/isolation.c:25:23: note: 'cpumasks' declared here
      25 |         cpumask_var_t cpumasks[HK_TYPE_MAX];
         |                       ^~~~~~~~

vim +115 kernel/sched/isolation.c

106
107 static void housekeeping_setup_type(enum hk_type type,
108 cpumask_var_t housekeeping_staging)
109 {
110 unsigned int gfp = GFP_KERNEL;
111
112 if (system_state < SYSTEM_RUNNING)
113 gfp = GFP_NOWAIT;
114

 > 115		if (!housekeeping.cpumasks[type])

116 alloc_cpumask_var(&housekeeping.cpumasks[type], gfp);
117
118 cpumask_copy(housekeeping.cpumasks[type],
119 housekeeping_staging);
120 }
121

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw

RFC PATCH 2/12 sched/isolation: Introduce reconfiguration notifier chain

In reply to Qiliang Yuan

Introduce a blocking notifier chain for housekeeping to support dynamic reconfiguration of masks. Subsystems like RCU, Timers, and IRQ management need to be notified when the isolation state of a CPU changes at runtime.

1. Define 'struct housekeeping_update' and 'HK_UPDATE_MASK' in isolation.h to pass update event details (type of housekeeping and the new mask).
2. Implement housekeeping_register_notifier() and housekeeping_unregister_notifier() to allow subsystems to subscribe to updates.
3. Provide an internal housekeeping_update_notify() helper to trigger the chain.

This signaling mechanism enables other kernel subsystems to adapt their internal state (e.g., migrating kthreads or timers) dynamically when housekeeping masks are modified via upcoming sysfs interfaces.

---
 include/linux/sched/isolation.h | 20 ++++++++++++++++++++
 kernel/sched/isolation.c        | 23 +++++++++++++++++++++++
 2 files changed, 43 insertions(+)
include/linux/sched/isolation.h +20 -0
index cecb80b09120..5c07e3e9b8d1 100644
@@ -5,6 +5,7 @@
 #include <linux/cpuset.h>
 #include <linux/init.h>
 #include <linux/tick.h>
+#include <linux/notifier.h>
 
 enum hk_type {
 	HK_TYPE_DOMAIN,
@@ -24,6 +25,13 @@ enum hk_type {
 	HK_TYPE_KTHREAD = HK_TYPE_KERNEL_NOISE
 };
 
+struct housekeeping_update {
+	enum hk_type type;
+	const struct cpumask *new_mask;
+};
+
+#define HK_UPDATE_MASK	0x01
+
 #ifdef CONFIG_CPU_ISOLATION
 DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
 extern int housekeeping_any_cpu(enum hk_type type);
@@ -32,6 +40,8 @@ extern bool housekeeping_enabled(enum hk_type type);
 extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
 extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
 extern void housekeeping_init(void);
+extern int housekeeping_register_notifier(struct notifier_block *nb);
+extern int housekeeping_unregister_notifier(struct notifier_block *nb);
 
 #else
 
@@ -59,6 +69,16 @@ static inline bool housekeeping_test_cpu(int cpu, enum hk_type type)
 }
 
 static inline void housekeeping_init(void) { }
+
+static inline int housekeeping_register_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+
+static inline int housekeeping_unregister_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
 #endif /* CONFIG_CPU_ISOLATION */
 
 static inline bool housekeeping_cpu(int cpu, enum hk_type type)
kernel/sched/isolation.c +23 -0
index 811bf6cbe68d..97cc41626a33 100644
@@ -18,6 +18,7 @@ enum hk_flags {
 };
 
 static DEFINE_MUTEX(housekeeping_mutex);
+static BLOCKING_NOTIFIER_HEAD(housekeeping_notifier_list);
 DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
 EXPORT_SYMBOL_GPL(housekeeping_overridden);
 
@@ -86,6 +87,28 @@ bool housekeeping_test_cpu(int cpu, enum hk_type type)
 }
 EXPORT_SYMBOL_GPL(housekeeping_test_cpu);
 
+int housekeeping_register_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&housekeeping_notifier_list, nb);
+}
+EXPORT_SYMBOL_GPL(housekeeping_register_notifier);
+
+int housekeeping_unregister_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&housekeeping_notifier_list, nb);
+}
+EXPORT_SYMBOL_GPL(housekeeping_unregister_notifier);
+
+static int __maybe_unused housekeeping_update_notify(enum hk_type type, const struct cpumask *new_mask)
+{
+	struct housekeeping_update update = {
+		.type = type,
+		.new_mask = new_mask,
+	};
+
+	return blocking_notifier_call_chain(&housekeeping_notifier_list, HK_UPDATE_MASK, &update);
+}
+
 void housekeeping_init(void)
 {
 	enum hk_type type;
Signature · 1 line
2.51.0
#4 lore raw

RFC PATCH 3/12 genirq: Implement dynamic migration for Managed IRQs

In reply to Qiliang Yuan

Support dynamic reconfiguration of CPU isolation by making the managed interrupts responsive to housekeeping mask changes at runtime.

1. Register a housekeeping notifier in the genirq subsystem to listen for HK_TYPE_MANAGED_IRQ updates.
2. Iterate through all active interrupts when a mask update occurs.
3. Re-apply affinity for managed interrupts to ensure they honor the newly configured housekeeping mask.
4. Use irq_set_affinity_locked() to trigger migration away from newly isolated CPUs or towards newly designated housekeeping CPUs.

---
 kernel/irq/manage.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
kernel/irq/manage.c +52 -0
index 349ae7979da0..9523f0655b12 100644
@@ -21,6 +21,7 @@
 #include <linux/sched/isolation.h>
 #include <uapi/linux/sched/types.h>
 #include <linux/task_work.h>
+#include <linux/cpuhotplug.h>
 
 #include "internals.h"
 
@@ -2811,3 +2812,54 @@ bool irq_check_status_bit(unsigned int irq, unsigned int bitmask)
 	return res;
 }
 EXPORT_SYMBOL_GPL(irq_check_status_bit);
+
+#ifdef CONFIG_SMP
+static int irq_housekeeping_reconfigure(struct notifier_block *nb,
+					unsigned long action, void *data)
+{
+	struct housekeeping_update *upd = data;
+	struct irq_desc *desc;
+	unsigned int irq;
+
+	if (action != HK_UPDATE_MASK || upd->type != HK_TYPE_MANAGED_IRQ)
+		return NOTIFY_OK;
+
+	irq_lock_sparse();
+	for_each_active_irq(irq) {
+		struct irq_data *id;
+
+		desc = irq_to_desc(irq);
+		if (!desc)
+			continue;
+
+		scoped_guard(raw_spinlock_irqsave, &desc->lock) {
+			id = irq_desc_get_irq_data(desc);
+			if (!irqd_affinity_is_managed(id) || !desc->action ||
+			    !irq_data_get_irq_chip(id))
+				continue;
+
+			/*
+			 * Re-apply existing affinity to honor the new
+			 * housekeeping mask via __irq_set_affinity() logic.
+			 */
+			irq_set_affinity_locked(id, irq_data_get_affinity_mask(id), false);
+		}
+	}
+	irq_unlock_sparse();
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block irq_housekeeping_nb = {
+	.notifier_call = irq_housekeeping_reconfigure,
+};
+
+static int __init irq_init_housekeeping_notifier(void)
+{
+	housekeeping_register_notifier(&irq_housekeeping_nb);
+	return 0;
+}
+core_initcall(irq_init_housekeeping_notifier);
+#endif
+
+
Signature · 1 line
2.51.0
maintainer
#5 lore raw

Re: [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs

On Fri, Feb 06 2026 at 02:04, Qiliang Yuan wrote:

s/Managed IRQs/managed interrupts/ in $subject

Quoted 10 lines

Support dynamic reconfiguration of CPU isolation by making the managed interrupts responsive to housekeeping mask changes at runtime.

1. Register a housekeeping notifier in the genirq subsystem to listen for HK_TYPE_MANAGED_IRQ updates.
2. Iterate through all active interrupts when a mask update occurs.
3. Re-apply affinity for managed interrupts to ensure they honor the newly configured housekeeping mask.
4. Use irq_set_affinity_locked() to trigger migration away from newly isolated CPUs or towards newly designated housekeeping CPUs.

Please don't explain implementation details in the change log. They can be seen from the patch. Explain the why and the concept of the change

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog

Quoted 2 lines

So you developed that together with your alter ego? Pick one please.

kernel/irq/manage.c bool irq_check_status_bit(unsigned int irq, unsigned int bitmask) · line 2821

Quoted 6 lines
kernel/irq/manage.c +6 -0
+#ifdef CONFIG_SMP
+static int irq_housekeeping_reconfigure(struct notifier_block *nb,
+					unsigned long action, void *data)
+{
+	struct housekeeping_update *upd = data;
+	struct irq_desc *desc;

Move desc into the loop

kernel/irq/manage.c bool irq_check_status_bit(unsigned int irq, unsigned int bitmask) · line 2829

Quoted 8 lines
kernel/irq/manage.c +8 -0
+	unsigned int irq;
+
+	if (action != HK_UPDATE_MASK || upd->type != HK_TYPE_MANAGED_IRQ)
+		return NOTIFY_OK;
+
+	irq_lock_sparse();
+	for_each_active_irq(irq) {
+		struct irq_data *id;

id is really not a intuitive name. Most code here uses 'irqd'.

kernel/irq/manage.c bool irq_check_status_bit(unsigned int irq, unsigned int bitmask) · line 2835

Quoted 5 lines
kernel/irq/manage.c +5 -0
+		desc = irq_to_desc(irq);
+		if (!desc)
+			continue;
+
+		scoped_guard(raw_spinlock_irqsave, &desc->lock) {

raw_spinlock_irq. There is nothing to save here as this is preemptible thread context, no?

You can simplify all of the above by using:

	scoped_irqdesc_get_and_lock(irq, 0) {
        	struct irq_data *irqd = irq_desc_get_irq_data(scoped_irqdesc);

                ....

kernel/irq/manage.c bool irq_check_status_bit(unsigned int irq, unsigned int bitmask) · line 2838

Quoted 3 lines
kernel/irq/manage.c +3 -0
+			id = irq_desc_get_irq_data(desc);
+			if (!irqd_affinity_is_managed(id) || !desc->action ||
+			    !irq_data_get_irq_chip(id))

No line break required. You have 100 characters.

Review

Quoted 1 line
(quoted diff) +1 -0
+				continue;

Thanks,

tglx

#6 lore raw

RFC PATCH 4/12 rcu: Sync RCU housekeeping mask on notification

In reply to Qiliang Yuan

When the housekeeping CPU mask for RCU is updated at runtime, RCU grace-period kthreads and tasks-RCU kthreads should be migrated to the newly designated housekeeping CPUs.

1. Implement rcu_housekeeping_reconfigure() to handle HK_UPDATE_MASK events for HK_TYPE_RCU.
2. Update the affinity of rcu_state.gp_kthread when the mask changes.
3. Register the RCU housekeeping notifier during late initialization.

This ensures RCU kthreads honor dynamic isolation settings without requiring a system reboot.

---
 kernel/rcu/tree.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
kernel/rcu/tree.c +43 -0
index 293bbd9ac3f4..ec496e4bd24f 100644
@@ -48,6 +48,7 @@
 #include <linux/delay.h>
 #include <linux/random.h>
 #include <linux/trace_events.h>
+#include <linux/sched/isolation.h>
 #include <linux/suspend.h>
 #include <linux/ftrace.h>
 #include <linux/tick.h>
@@ -4913,7 +4914,49 @@ void __init rcu_init(void)
 	tasks_cblist_init_generic();
 }
 
+#ifdef CONFIG_SMP
+static int rcu_housekeeping_reconfigure(struct notifier_block *nb,
+					unsigned long action, void *data)
+{
+	struct housekeeping_update *upd = data;
+	struct task_struct *t;
+
+	if (action != HK_UPDATE_MASK || upd->type != HK_TYPE_RCU)
+		return NOTIFY_OK;
+
+	t = READ_ONCE(rcu_state.gp_kthread);
+	if (t)
+		housekeeping_affine(t, HK_TYPE_RCU);
+
+#ifdef CONFIG_TASKS_RCU
+	t = get_rcu_tasks_gp_kthread();
+	if (t)
+		housekeeping_affine(t, HK_TYPE_RCU);
+#endif
+
+#ifdef CONFIG_TASKS_RUDE_RCU
+	t = get_rcu_tasks_rude_gp_kthread();
+	if (t)
+		housekeeping_affine(t, HK_TYPE_RCU);
+#endif
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block rcu_housekeeping_nb = {
+	.notifier_call = rcu_housekeeping_reconfigure,
+};
+
+static int __init rcu_init_housekeeping_notifier(void)
+{
+	housekeeping_register_notifier(&rcu_housekeeping_nb);
+	return 0;
+}
+late_initcall(rcu_init_housekeeping_notifier);
+#endif
+
 #include "tree_stall.h"
 #include "tree_exp.h"
 #include "tree_nocb.h"
 #include "tree_plugin.h"
+
Signature · 1 line
2.51.0
#7 lore raw

RFC PATCH 5/12 sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN)

In reply to Qiliang Yuan

The housekeeping mask for scheduler domains (HK_TYPE_DOMAIN) is used to determine which CPUs are isolated from the general scheduler load balancing. When this mask is updated at runtime, we need to rebuild the scheduler domains to reflect the new isolation boundaries.

Register a housekeeping notifier in the scheduler core to trigger rebuild_sched_domains() when the HK_TYPE_DOMAIN mask changes.

---
 kernel/sched/topology.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
kernel/sched/topology.c +26 -0
index cf643a5ddedd..7f218fc62183 100644
@@ -4,6 +4,7 @@
  */
 
 #include <linux/sched/isolation.h>
+#include <linux/cpuset.h>
 #include <linux/bsearch.h>
 #include "sched.h"
 
@@ -2940,3 +2941,28 @@ void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
 	partition_sched_domains_locked(ndoms_new, doms_new, dattr_new);
 	sched_domains_mutex_unlock();
 }
+
+static int sched_housekeeping_reconfigure(struct notifier_block *nb,
+					 unsigned long action, void *data)
+{
+	if (action == HK_UPDATE_MASK) {
+		unsigned int type = (unsigned long)data;
+
+		if (type == HK_TYPE_DOMAIN)
+			rebuild_sched_domains();
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block sched_housekeeping_nb = {
+	.notifier_call = sched_housekeeping_reconfigure,
+};
+
+static int __init sched_housekeeping_init(void)
+{
+	housekeeping_register_notifier(&sched_housekeeping_nb);
+	return 0;
+}
+core_initcall(sched_housekeeping_init);
+
Signature · 1 line
2.51.0
#8 lore raw

RFC PATCH 6/12 watchdog: Allow runtime toggle of hardlockup detector on CPUs

In reply to Qiliang Yuan

The lockup detector (watchdog) affinity is initially set based on the HK_TYPE_TIMER housekeeping mask. However, if this mask is updated at runtime, the watchdog threads remain on their original CPUs.

Register a housekeeping notifier to update watchdog_cpumask and trigger a reconfiguration via proc_watchdog_update() when the HK_TYPE_TIMER housekeeping mask changes. This ensures that watchdog threads are synchronized with the new isolation boundaries.

---
 kernel/watchdog.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
kernel/watchdog.c +24 -0
index 366122f4a0f8..2922d7f93d61 100644
@@ -26,6 +26,7 @@
 #include <linux/sysctl.h>
 #include <linux/tick.h>
 #include <linux/sys_info.h>
+#include <linux/sched/isolation.h>
 
 #include <linux/sched/clock.h>
 #include <linux/sched/debug.h>
@@ -1359,6 +1360,28 @@ static int __init lockup_detector_check(void)
 }
 late_initcall_sync(lockup_detector_check);
 
+static int watchdog_housekeeping_reconfigure(struct notifier_block *nb,
+					    unsigned long action, void *data)
+{
+	if (action == HK_UPDATE_MASK) {
+		unsigned int type = (unsigned long)data;
+
+		if (type == HK_TYPE_TIMER) {
+			mutex_lock(&watchdog_mutex);
+			cpumask_copy(&watchdog_cpumask,
+				     housekeeping_cpumask(HK_TYPE_TIMER));
+			proc_watchdog_update(false);
+			mutex_unlock(&watchdog_mutex);
+		}
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block watchdog_housekeeping_nb = {
+	.notifier_call = watchdog_housekeeping_reconfigure,
+};
+
 void __init lockup_detector_init(void)
 {
 	if (tick_nohz_full_enabled())
@@ -1373,4 +1396,5 @@ void __init lockup_detector_init(void)
 		allow_lockup_detector_init_retry = true;
 
 	lockup_detector_setup();
+	housekeeping_register_notifier(&watchdog_housekeeping_nb);
 }
Signature · 1 line
2.51.0
#9 lore raw

Re: [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs

kernel test robot noticed the following build errors:

Hi Qiliang,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on 1f97d9dcf53649c41c33227b345a36902cbb08ad]

url:    https://github.com/intel-lab-lkp/linux/commits/Qiliang-Yuan/sched-isolation-Remove-__init-restriction-from-housekeeping-cores/20260206-150801
base:   1f97d9dcf53649c41c33227b345a36902cbb08ad
patch link:    https://lore.kernel.org/r/20260206-feature-dynamic_isolcpus_dhei-v1-6-00a711eb0c74%40gmail.com
patch subject: [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs
config: arc-randconfig-002-20260208 (https://download.01.org/0day-ci/archive/20260208/[email protected]/config)
compiler: arc-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260208/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

kernel/watchdog.c: In function 'watchdog_housekeeping_reconfigure':

>> kernel/watchdog.c:1373:25: error: implicit declaration of function 'proc_watchdog_update' [-Werror=implicit-function-declaration]
    1373 |                         proc_watchdog_update(false);
         |                         ^~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/proc_watchdog_update +1373 kernel/watchdog.c

1362
1363 static int watchdog_housekeeping_reconfigure(struct notifier_block *nb,
1364 unsigned long action, void *data)
1365 {
1366 if (action == HK_UPDATE_MASK) {
1367 unsigned int type = (unsigned long)data;
1368
1369 if (type == HK_TYPE_TIMER) {
1370 mutex_lock(&watchdog_mutex);
1371 cpumask_copy(&watchdog_cpumask,
1372 housekeeping_cpumask(HK_TYPE_TIMER));

> 1373				proc_watchdog_update(false);

1374 mutex_unlock(&watchdog_mutex);
1375 }
1376 }
1377
1378 return NOTIFY_OK;
1379 }
1380

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

RFC PATCH 7/12 workqueue: Dynamic housekeeping mask update support

In reply to Qiliang Yuan

Workqueues use housekeeping masks (HK_TYPE_WQ and HK_TYPE_DOMAIN) to determine the default affinity for unbound workqueues. Currently, these masks are only applied during early boot.

Register a housekeeping notifier to dynamically update the workqueue unbound cpumask when these housekeeping masks are changed at runtime. This ensures that unbound workqueues are re-affined to the new housekeeping CPUs. Also update wq_isolated_cpumask to reflect the changes in HK_TYPE_DOMAIN.

---
 kernel/workqueue.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
kernel/workqueue.c +39 -0
index 253311af47c6..b8913935d5e8 100644
@@ -7913,6 +7913,44 @@ static void __init wq_cpu_intensive_thresh_init(void)
  * executing the work items yet. Populate the worker pools with the initial
  * workers and enable future kworker creations.
  */
+static int wq_housekeeping_reconfigure(struct notifier_block *nb,
+				      unsigned long action, void *data)
+{
+	if (action == HK_UPDATE_MASK) {
+		unsigned int type = (unsigned long)data;
+
+		if (type == HK_TYPE_WQ || type == HK_TYPE_DOMAIN) {
+			cpumask_var_t cpumask;
+
+			if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
+				return NOTIFY_BAD;
+
+			cpumask_copy(cpumask, cpu_possible_mask);
+			if (!cpumask_empty(housekeeping_cpumask(HK_TYPE_WQ)))
+				cpumask_and(cpumask, cpumask, housekeeping_cpumask(HK_TYPE_WQ));
+			if (!cpumask_empty(housekeeping_cpumask(HK_TYPE_DOMAIN)))
+				cpumask_and(cpumask, cpumask, housekeeping_cpumask(HK_TYPE_DOMAIN));
+
+			workqueue_set_unbound_cpumask(cpumask);
+
+			if (type == HK_TYPE_DOMAIN) {
+				apply_wqattrs_lock();
+				cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask,
+						housekeeping_cpumask(HK_TYPE_DOMAIN));
+				apply_wqattrs_unlock();
+			}
+
+			free_cpumask_var(cpumask);
+		}
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block wq_housekeeping_nb = {
+	.notifier_call = wq_housekeeping_reconfigure,
+};
+
 void __init workqueue_init(void)
 {
 	struct workqueue_struct *wq;
@@ -7964,6 +8002,7 @@ void __init workqueue_init(void)
 
 	wq_online = true;
 	wq_watchdog_init();
+	housekeeping_register_notifier(&wq_housekeeping_nb);
 }
 
 /*
Signature · 1 line
2.51.0
#11 lore raw

Re: [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support

kernel test robot noticed the following build warnings:

Hi Qiliang,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:

[auto build test WARNING on 1f97d9dcf53649c41c33227b345a36902cbb08ad]

url:    https://github.com/intel-lab-lkp/linux/commits/Qiliang-Yuan/sched-isolation-Remove-__init-restriction-from-housekeeping-cores/20260206-150801
base:   1f97d9dcf53649c41c33227b345a36902cbb08ad
patch link:    https://lore.kernel.org/r/20260206-feature-dynamic_isolcpus_dhei-v1-7-00a711eb0c74%40gmail.com
patch subject: [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support
config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20260207/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260207/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> Warning: kernel/workqueue.c:7917 function parameter 'nb' not described in 'wq_housekeeping_reconfigure'
>> Warning: kernel/workqueue.c:7917 function parameter 'action' not described in 'wq_housekeeping_reconfigure'
>> Warning: kernel/workqueue.c:7917 function parameter 'data' not described in 'wq_housekeeping_reconfigure'
>> Warning: kernel/workqueue.c:7917 expecting prototype for workqueue_init(). Prototype was for wq_housekeeping_reconfigure() instead
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#12 lore raw

RFC PATCH 8/12 kcompactd: Add housekeeping notifier for dynamic mask update

In reply to Qiliang Yuan

The kcompactd threads should respect the housekeeping mask for kthreads (HK_TYPE_KTHREAD) to avoid running on isolated CPUs. Currently, they are created without explicit affinity constraints beyond the node preference.

Add housekeeping_affine() to kcompactd_run() to set initial affinity, and register a housekeeping notifier to update kcompactd affinity when the HK_TYPE_KTHREAD mask is changed at runtime.

---
 mm/compaction.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
mm/compaction.c +26 -0
index 1e8f8eca318c..495106d970f1 100644
@@ -24,6 +24,7 @@
 #include <linux/page_owner.h>
 #include <linux/psi.h>
 #include <linux/cpuset.h>
+#include <linux/sched/isolation.h>
 #include "internal.h"
 
 #ifdef CONFIG_COMPACTION
@@ -3246,6 +3247,7 @@ void __meminit kcompactd_run(int nid)
 		pr_err("Failed to start kcompactd on node %d\n", nid);
 		pgdat->kcompactd = NULL;
 	} else {
+		housekeeping_affine(pgdat->kcompactd, HK_TYPE_KTHREAD);
 		wake_up_process(pgdat->kcompactd);
 	}
 }
@@ -3320,6 +3322,29 @@ static const struct ctl_table vm_compaction[] = {
 	},
 };
 
+static int kcompactd_housekeeping_reconfigure(struct notifier_block *nb,
+					     unsigned long action, void *data)
+{
+	unsigned int type = (unsigned long)data;
+
+	if (action == HK_UPDATE_MASK && type == HK_TYPE_KTHREAD) {
+		int nid;
+
+		for_each_node_state(nid, N_MEMORY) {
+			pg_data_t *pgdat = NODE_DATA(nid);
+
+			if (pgdat->kcompactd)
+				housekeeping_affine(pgdat->kcompactd, HK_TYPE_KTHREAD);
+		}
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block kcompactd_housekeeping_nb = {
+	.notifier_call = kcompactd_housekeeping_reconfigure,
+};
+
 static int __init kcompactd_init(void)
 {
 	int nid;
@@ -3327,6 +3352,7 @@ static int __init kcompactd_init(void)
 	for_each_node_state(nid, N_MEMORY)
 		kcompactd_run(nid);
 	register_sysctl_init("vm", vm_compaction);
+	housekeeping_register_notifier(&kcompactd_housekeeping_nb);
 	return 0;
 }
 subsys_initcall(kcompactd_init)
Signature · 1 line
2.51.0
reviewer
#13 lore raw

Re: [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update

Quoted 9 lines · Qiliang Yuan

The kcompactd threads should respect the housekeeping mask for kthreads (HK_TYPE_KTHREAD) to avoid running on isolated CPUs. Currently, they are created without explicit affinity constraints beyond the node preference.

Add housekeeping_affine() to kcompactd_run() to set initial affinity, and register a housekeeping notifier to update kcompactd affinity when the HK_TYPE_KTHREAD mask is changed at runtime.

How about khugepaged and kswapd?

khugepaged thread is created in start_stop_khugepaged() from mm/khugepaged.c. kswapd threads are created in kswapd_init() from mm/vmscan.c.

Quoted 6 lines
---
 mm/compaction.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Best Regards,
Yan, Zi

#14 lore raw

RFC PATCH 9/12 sched/isolation: Separate housekeeping types and add sysfs interface

In reply to Qiliang Yuan

Currently, most housekeeping types (timer, rcu, misc, etc.) share the same mask (HK_TYPE_KERNEL_NOISE), preventing fine-grained control over CPU isolation. Additionally, there is no way to update these masks at runtime.

Separate the housekeeping types into individual enum entries and expand the cpumasks array to accommodate them. Introduce a sysfs interface at /sys/kernel/housekeeping/ that allows users to view and update the housekeeping masks for each type at runtime. When a mask is updated via sysfs, a notifier is triggered to re-affine the relevant kernel subsystems and services.

---
 include/linux/sched/isolation.h |  20 +++---
 kernel/sched/isolation.c        | 134 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 140 insertions(+), 14 deletions(-)
include/linux/sched/isolation.h +8 -12
index 5c07e3e9b8d1..e8fe1cfa5022 100644
@@ -10,21 +10,17 @@
 enum hk_type {
 	HK_TYPE_DOMAIN,
 	HK_TYPE_MANAGED_IRQ,
-	HK_TYPE_KERNEL_NOISE,
+	HK_TYPE_TICK,
+	HK_TYPE_TIMER,
+	HK_TYPE_RCU,
+	HK_TYPE_MISC,
+	HK_TYPE_WQ,
+	HK_TYPE_KTHREAD,
 	HK_TYPE_MAX,
-
-	/*
-	 * The following housekeeping types are only set by the nohz_full
-	 * boot commandline option. So they can share the same value.
-	 */
-	HK_TYPE_TICK    = HK_TYPE_KERNEL_NOISE,
-	HK_TYPE_TIMER   = HK_TYPE_KERNEL_NOISE,
-	HK_TYPE_RCU     = HK_TYPE_KERNEL_NOISE,
-	HK_TYPE_MISC    = HK_TYPE_KERNEL_NOISE,
-	HK_TYPE_WQ      = HK_TYPE_KERNEL_NOISE,
-	HK_TYPE_KTHREAD = HK_TYPE_KERNEL_NOISE
 };
 
+#define HK_TYPE_KERNEL_NOISE HK_TYPE_TICK
+
 struct housekeeping_update {
 	enum hk_type type;
 	const struct cpumask *new_mask;
kernel/sched/isolation.c +132 -2

159 lines not on this page · raw message

Signature · 1 line
2.51.0
#15 lore raw

RFC PATCH 10/12 tick/nohz: Implement dynamic nohz_full state update

In reply to Qiliang Yuan

The nohz_full state (tick_nohz_full_mask) is currently a boot-time configuration that cannot be changed at runtime. This prevents dynamic CPU isolation from being fully effective, as the scheduler tick continues to run on newly isolated CPUs.

Remove the __init restriction from tick_nohz_full_setup() and tick_nohz_init(). Implement a housekeeping notifier in the tick-sched subsystem to handle HK_TYPE_TICK updates. When the mask is updated, the new isolation mask is calculated and applied, and all online CPUs are kicked to re-evaluate their tick dependency.

This allows the kernel to dynamically enter or exit full dynticks mode on any CPU at runtime.

---
 include/linux/tick.h     |  2 +-
 kernel/time/tick-sched.c | 63 +++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 61 insertions(+), 4 deletions(-)
include/linux/tick.h +1 -1
index ac76ae9fa36d..40047523ec8c 100644
@@ -271,7 +271,7 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,
 
 extern void tick_nohz_full_kick_cpu(int cpu);
 extern void __tick_nohz_task_switch(void);
-extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);
+extern void tick_nohz_full_setup(cpumask_var_t cpumask);
 #else
 static inline bool tick_nohz_full_enabled(void) { return false; }
 static inline bool tick_nohz_full_cpu(int cpu) { return false; }
kernel/time/tick-sched.c +60 -3

85 lines not on this page · raw message

Signature · 1 line
2.51.0
#16 lore raw

RFC PATCH 11/12 sched/isolation: Implement SMT sibling auto-isolation and safety check

In reply to Qiliang Yuan

Implement SMT sibling auto-isolation logic via 'smt_aware_mode' sysfs node. When enabled, writing to housekeeping masks will automatically ensure that all siblings of a physical core stay together in the same isolation state.

Also implement a safety check in housekeeping_store() to ensure that at least one online CPU remains as housekeeping, preventing the user from accidentally isolating all CPUs and locking up the system.

---
 kernel/sched/isolation.c | 72 ++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)
kernel/sched/isolation.c +67 -5
index d9ce26cf31fe..30798e790b9f 100644
@@ -13,6 +13,7 @@
 #include <linux/sysfs.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
+#include <linux/topology.h>
 #include "sched.h"
 
 enum hk_flags {
@@ -40,6 +41,30 @@ struct housekeeping {
 };
 
 static struct housekeeping housekeeping;
+static bool housekeeping_smt_aware;
+
+static ssize_t smt_aware_show(struct kobject *kobj,
+			     struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf, "%d\n", housekeeping_smt_aware);
+}
+
+static ssize_t smt_aware_store(struct kobject *kobj,
+			      struct kobj_attribute *attr,
+			      const char *buf, size_t count)
+{
+	bool val;
+
+	if (kstrtobool(buf, &val))
+		return -EINVAL;
+
+	housekeeping_smt_aware = val;
+
+	return count;
+}
+
+static struct kobj_attribute smt_aware_attr =
+	__ATTR(smt_aware_mode, 0644, smt_aware_show, smt_aware_store);
 
 bool housekeeping_enabled(enum hk_type type)
 {
@@ -164,11 +189,40 @@ static ssize_t housekeeping_store(struct kobject *kobject,
 	if (err)
 		goto out_free;
 
-	if (cpumask_empty(new_mask)) {
+	/* Safety check: must have at least one online CPU for housekeeping */
+	if (!cpumask_intersects(new_mask, cpu_online_mask)) {
 		err = -EINVAL;
 		goto out_free;
 	}
 
+	if (housekeeping_smt_aware) {
+		int cpu, sibling;
+		cpumask_var_t tmp_mask;
+
+		if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL)) {
+			err = -ENOMEM;
+			goto out_free;
+		}
+
+		cpumask_copy(tmp_mask, new_mask);
+		for_each_cpu(cpu, tmp_mask) {
+			for_each_cpu(sibling, topology_sibling_cpumask(cpu)) {
+				if (!cpumask_test_cpu(sibling, tmp_mask)) {
+					/* SMT sibling should stay grouped */
+					cpumask_clear_cpu(cpu, new_mask);
+					break;
+				}
+			}
+		}
+		free_cpumask_var(tmp_mask);
+
+		/* Re-check after SMT sync */
+		if (!cpumask_intersects(new_mask, cpu_online_mask)) {
+			err = -EINVAL;
+			goto out_free;
+		}
+	}
+
 	mutex_lock(&housekeeping_mutex);
 	
 	if (!housekeeping.cpumasks[type]) {
@@ -230,12 +284,20 @@ static int __init housekeeping_sysfs_init(void)
 	housekeeping_attr_ptr[j] = NULL;
 
 	ret = sysfs_create_group(housekeeping_kobj, &housekeeping_attr_group);
-	if (ret) {
-		kobject_put(housekeeping_kobj);
-		return ret;
-	}
+	if (ret)
+		goto err_group;
+
+	ret = sysfs_create_file(housekeeping_kobj, &smt_aware_attr.attr);
+	if (ret)
+		goto err_file;
 
 	return 0;
+
+err_file:
+	sysfs_remove_group(housekeeping_kobj, &housekeeping_attr_group);
+err_group:
+	kobject_put(housekeeping_kobj);
+	return ret;
 }
 late_initcall(housekeeping_sysfs_init);
 
Signature · 1 line
2.51.0
#17 lore raw

RFC PATCH 12/12 sched/isolation: Bridge isolcpus and support runtime tick offload init

In reply to Qiliang Yuan

Bridge the boot-time 'isolcpus' and 'nohz_full' parameters with the DHEI sysfs interface. Ensure that housekeeping_init() correctly initializes the isolation state and that subsequent sysfs updates can take over management even if no isolation was configured at boot.

Remove __init from sched_tick_offload_init() and update it to be safe for multiple calls. This allows DHEI to initialize tick offload infrastructure at runtime when the first tick-isolated core is configured.

---
 kernel/sched/core.c      | 5 ++++-
 kernel/sched/isolation.c | 3 +++
 kernel/sched/sched.h     | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
kernel/sched/core.c +4 -1
index 045f83ad261e..d155e1132d6b 100644
@@ -5685,8 +5685,11 @@ static void sched_tick_stop(int cpu)
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
-int __init sched_tick_offload_init(void)
+int sched_tick_offload_init(void)
 {
+	if (tick_work_cpu)
+		return 0;
+
 	tick_work_cpu = alloc_percpu(struct tick_work);
 	BUG_ON(!tick_work_cpu);
 	return 0;
kernel/sched/isolation.c +3 -0
index 30798e790b9f..76c039a01fb0 100644
@@ -241,6 +241,9 @@ static ssize_t housekeeping_store(struct kobject *kobject,
 	housekeeping.flags |= BIT(type);
 	static_branch_enable(&housekeeping_overridden);
 	
+	if (type == HK_TYPE_TICK || type == HK_TYPE_TIMER || type == HK_TYPE_RCU)
+		sched_tick_offload_init();
+
 	housekeeping_update_notify(type, new_mask);
 	
 	err = count;
kernel/sched/sched.h +1 -1
index 93fce4bbff5e..0079e7210c38 100644
@@ -2867,7 +2867,7 @@ extern void post_init_entity_util_avg(struct task_struct *p);
 
 #ifdef CONFIG_NO_HZ_FULL
 extern bool sched_can_stop_tick(struct rq *rq);
-extern int __init sched_tick_offload_init(void);
+extern int sched_tick_offload_init(void);
 
 /*
  * Tick may be needed by tasks in the runqueue depending on their policy and
Signature · 1 line
2.51.0
maintainer
#18 lore raw
In reply to Qiliang Yuan
Quoted 9 lines · Qiliang Yuan

The Linux kernel provides mechanisms like 'isolcpus' and 'nohz_full' to reduce interference for latency-sensitive workloads. However, these are locked behind the "Reboot Wall" - they can only be configured via boot parameters and require a system restart to change.

*** THIS IS AN RFC ***
This series is being submitted as an Request For Comments to discuss the architectural changes required to support dynamic reconfiguration of housekeeping boundaries. Key points for discussion:

[...]

Quoted 3 lines

This series provides the necessary infrastructure for cloud-native orchestrators and high-frequency trading platforms to dynamically re-partition CPU resources without incurring the downtime of a reboot.

Could you provide more details of the usecase and hardware / CPU topology? In which situations does a boot time isolation boundary not work? I think knowing that will help discuss the need for this.

These systems typically have a lot of cores, and only a few of them need to be isolated I believe (that's my usecase anyway at my day job).

thanks,

--
Joel Fernandes

Quoted 38 lines

---
Qiliang Yuan (12):
sched/isolation: Remove __init restriction from housekeeping cores sched/isolation: Introduce reconfiguration notifier chain
genirq: Implement dynamic migration for Managed IRQs
rcu: Sync RCU housekeeping mask on notification sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN)
watchdog: Allow runtime toggle of hardlockup detector on CPUs
workqueue: Dynamic housekeeping mask update support
kcompactd: Add housekeeping notifier for dynamic mask update sched/isolation: Separate housekeeping types and add sysfs interface tick/nohz: Implement dynamic nohz_full state update sched/isolation: Implement SMT sibling auto-isolation and safety check sched/isolation: Bridge isolcpus and support runtime tick offload init

 include/linux/sched/isolation.h |  40 +++++--
 include/linux/tick.h            |   2 +-
 kernel/irq/manage.c             |  52 +++++++++
 kernel/rcu/tree.c               |  43 +++++++
 kernel/sched/core.c             |   5 +-
 kernel/sched/isolation.c        | 252 ++++++++++++++++++++++++++++++++++++++--
 kernel/sched/sched.h            |   2 +-
 kernel/sched/topology.c         |  26 +++++
 kernel/time/tick-sched.c        |  63 +++++++++-
 kernel/watchdog.c               |  24 ++++
 kernel/workqueue.c              |  39 +++++++
 mm/compaction.c                 |  26 +++++
 12 files changed, 547 insertions(+), 27 deletions(-)

---
base-commit: 1f97d9dcf53649c41c33227b345a36902cbb08ad
change-id: 20260206-feature-dynamic_isolcpus_dhei-ee46b6e3a477

Best regards,

Signature · 1 line
Qiliang Yuan <[email protected]>