linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI)
@ 2026-02-06  7:04 Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores Qiliang Yuan
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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:
- 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
---
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,
-- 
Qiliang Yuan <realwujing@gmail.com>



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 02/12] sched/isolation: Introduce reconfiguration notifier chain Qiliang Yuan
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, Qiliang Yuan

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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 include/linux/sched/isolation.h |  2 +-
 kernel/sched/isolation.c        | 32 ++++++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index d8501f4709b5..cecb80b09120 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -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
 
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 3ad0d6df6a0a..811bf6cbe68d 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -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;
 }

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 02/12] sched/isolation: Introduce reconfiguration notifier chain
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs Qiliang Yuan
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 include/linux/sched/isolation.h | 20 ++++++++++++++++++++
 kernel/sched/isolation.c        | 23 +++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index cecb80b09120..5c07e3e9b8d1 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -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)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 811bf6cbe68d..97cc41626a33 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -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;

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 02/12] sched/isolation: Introduce reconfiguration notifier chain Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06 12:24   ` Thomas Gleixner
  2026-02-06  7:04 ` [PATCH RFC 04/12] rcu: Sync RCU housekeeping mask on notification Qiliang Yuan
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/irq/manage.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 349ae7979da0..9523f0655b12 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -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
+
+

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 04/12] rcu: Sync RCU housekeeping mask on notification
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (2 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 05/12] sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN) Qiliang Yuan
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/rcu/tree.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 293bbd9ac3f4..ec496e4bd24f 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -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"
+

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 05/12] sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN)
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (3 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 04/12] rcu: Sync RCU housekeeping mask on notification Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs Qiliang Yuan
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/sched/topology.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index cf643a5ddedd..7f218fc62183 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -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);
+

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (4 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 05/12] sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN) Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support Qiliang Yuan
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/watchdog.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 366122f4a0f8..2922d7f93d61 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -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);
 }

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (5 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update Qiliang Yuan
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/workqueue.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 253311af47c6..b8913935d5e8 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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);
 }
 
 /*

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (6 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06 15:09   ` Zi Yan
  2026-02-06  7:04 ` [PATCH RFC 09/12] sched/isolation: Separate housekeeping types and add sysfs interface Qiliang Yuan
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 mm/compaction.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/mm/compaction.c b/mm/compaction.c
index 1e8f8eca318c..495106d970f1 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -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)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 09/12] sched/isolation: Separate housekeeping types and add sysfs interface
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (7 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 10/12] tick/nohz: Implement dynamic nohz_full state update Qiliang Yuan
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 include/linux/sched/isolation.h |  20 +++---
 kernel/sched/isolation.c        | 134 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 140 insertions(+), 14 deletions(-)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 5c07e3e9b8d1..e8fe1cfa5022 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -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;
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 97cc41626a33..d9ce26cf31fe 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -9,14 +9,26 @@
  */
 #include <linux/sched/isolation.h>
 #include <linux/mutex.h>
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+#include <linux/slab.h>
+#include <linux/ctype.h>
 #include "sched.h"
 
 enum hk_flags {
 	HK_FLAG_DOMAIN		= BIT(HK_TYPE_DOMAIN),
 	HK_FLAG_MANAGED_IRQ	= BIT(HK_TYPE_MANAGED_IRQ),
-	HK_FLAG_KERNEL_NOISE	= BIT(HK_TYPE_KERNEL_NOISE),
+	HK_FLAG_TICK		= BIT(HK_TYPE_TICK),
+	HK_FLAG_TIMER		= BIT(HK_TYPE_TIMER),
+	HK_FLAG_RCU		= BIT(HK_TYPE_RCU),
+	HK_FLAG_MISC		= BIT(HK_TYPE_MISC),
+	HK_FLAG_WQ		= BIT(HK_TYPE_WQ),
+	HK_FLAG_KTHREAD		= BIT(HK_TYPE_KTHREAD),
 };
 
+#define HK_FLAG_KERNEL_NOISE (HK_FLAG_TICK | HK_FLAG_TIMER | HK_FLAG_RCU | \
+			      HK_FLAG_MISC | HK_FLAG_WQ | HK_FLAG_KTHREAD)
+
 static DEFINE_MUTEX(housekeeping_mutex);
 static BLOCKING_NOTIFIER_HEAD(housekeeping_notifier_list);
 DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
@@ -99,7 +111,7 @@ int housekeeping_unregister_notifier(struct notifier_block *nb)
 }
 EXPORT_SYMBOL_GPL(housekeeping_unregister_notifier);
 
-static int __maybe_unused housekeeping_update_notify(enum hk_type type, const struct cpumask *new_mask)
+static int housekeeping_update_notify(enum hk_type type, const struct cpumask *new_mask)
 {
 	struct housekeeping_update update = {
 		.type = type,
@@ -109,6 +121,124 @@ static int __maybe_unused housekeeping_update_notify(enum hk_type type, const st
 	return blocking_notifier_call_chain(&housekeeping_notifier_list, HK_UPDATE_MASK, &update);
 }
 
+static const char * const hk_type_names[] = {
+	[HK_TYPE_TIMER]		= "timer",
+	[HK_TYPE_RCU]		= "rcu",
+	[HK_TYPE_MISC]		= "misc",
+	[HK_TYPE_TICK]		= "tick",
+	[HK_TYPE_DOMAIN]	= "domain",
+	[HK_TYPE_WQ]		= "workqueue",
+	[HK_TYPE_MANAGED_IRQ]	= "managed_irq",
+	[HK_TYPE_KTHREAD]	= "kthread",
+};
+
+struct hk_attribute {
+	struct kobj_attribute kattr;
+	enum hk_type type;
+};
+
+#define to_hk_attr(_kattr) container_of(_kattr, struct hk_attribute, kattr)
+
+static ssize_t housekeeping_show(struct kobject *kobj,
+				struct kobj_attribute *attr, char *buf)
+{
+	struct hk_attribute *hk_attr = to_hk_attr(attr);
+	const struct cpumask *mask = housekeeping_cpumask(hk_attr->type);
+
+	return cpumap_print_to_pagebuf(false, buf, mask);
+}
+
+static ssize_t housekeeping_store(struct kobject *kobject,
+				 struct kobj_attribute *attr,
+				 const char *buf, size_t count)
+{
+	struct hk_attribute *hk_attr = to_hk_attr(attr);
+	enum hk_type type = hk_attr->type;
+	cpumask_var_t new_mask;
+	int err;
+
+	if (!alloc_cpumask_var(&new_mask, GFP_KERNEL))
+		return -ENOMEM;
+
+	err = cpulist_parse(buf, new_mask);
+	if (err)
+		goto out_free;
+
+	if (cpumask_empty(new_mask)) {
+		err = -EINVAL;
+		goto out_free;
+	}
+
+	mutex_lock(&housekeeping_mutex);
+	
+	if (!housekeeping.cpumasks[type]) {
+		if (!alloc_cpumask_var(&housekeeping.cpumasks[type], GFP_KERNEL)) {
+			err = -ENOMEM;
+			goto out_unlock;
+		}
+	}
+
+	if (cpumask_equal(housekeeping.cpumasks[type], new_mask)) {
+		err = 0;
+		goto out_unlock;
+	}
+
+	cpumask_copy(housekeeping.cpumasks[type], new_mask);
+	housekeeping.flags |= BIT(type);
+	static_branch_enable(&housekeeping_overridden);
+	
+	housekeeping_update_notify(type, new_mask);
+	
+	err = count;
+
+out_unlock:
+	mutex_unlock(&housekeeping_mutex);
+out_free:
+	free_cpumask_var(new_mask);
+	return err < 0 ? err : count;
+}
+
+static struct hk_attribute housekeeping_attrs[HK_TYPE_MAX];
+static struct attribute *housekeeping_attr_ptr[HK_TYPE_MAX + 1];
+
+static const struct attribute_group housekeeping_attr_group = {
+	.attrs = housekeeping_attr_ptr,
+};
+
+static int __init housekeeping_sysfs_init(void)
+{
+	struct kobject *housekeeping_kobj;
+	int i, j = 0;
+	int ret;
+
+	housekeeping_kobj = kobject_create_and_add("housekeeping", kernel_kobj);
+	if (!housekeeping_kobj)
+		return -ENOMEM;
+
+	for (i = 0; i < HK_TYPE_MAX; i++) {
+		if (!hk_type_names[i])
+			continue;
+
+		housekeeping_attrs[i].type = i;
+		sysfs_attr_init(&housekeeping_attrs[i].kattr.attr);
+		housekeeping_attrs[i].kattr.attr.name = hk_type_names[i];
+		housekeeping_attrs[i].kattr.attr.mode = 0644;
+		housekeeping_attrs[i].kattr.show = housekeeping_show;
+		housekeeping_attrs[i].kattr.store = housekeeping_store;
+		housekeeping_attr_ptr[j++] = &housekeeping_attrs[i].kattr.attr;
+	}
+	housekeeping_attr_ptr[j] = NULL;
+
+	ret = sysfs_create_group(housekeeping_kobj, &housekeeping_attr_group);
+	if (ret) {
+		kobject_put(housekeeping_kobj);
+		return ret;
+	}
+
+	return 0;
+}
+late_initcall(housekeeping_sysfs_init);
+
 void housekeeping_init(void)
 {
 	enum hk_type type;

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 10/12] tick/nohz: Implement dynamic nohz_full state update
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (8 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 09/12] sched/isolation: Separate housekeeping types and add sysfs interface Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 11/12] sched/isolation: Implement SMT sibling auto-isolation and safety check Qiliang Yuan
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 include/linux/tick.h     |  2 +-
 kernel/time/tick-sched.c | 63 +++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index ac76ae9fa36d..40047523ec8c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -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; }
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 2f8a7923fa27..01d62dfc153f 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -27,6 +27,7 @@
 #include <linux/posix-timers.h>
 #include <linux/context_tracking.h>
 #include <linux/mm.h>
+#include <linux/sched/isolation.h>
 
 #include <asm/irq_regs.h>
 
@@ -619,9 +620,14 @@ void __tick_nohz_task_switch(void)
 }
 
 /* Get the boot-time nohz CPU list from the kernel parameters. */
-void __init tick_nohz_full_setup(cpumask_var_t cpumask)
+void tick_nohz_full_setup(cpumask_var_t cpumask)
 {
-	alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
+	if (!tick_nohz_full_mask) {
+		if (system_state < SYSTEM_RUNNING)
+			alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
+		else
+			zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL);
+	}
 	cpumask_copy(tick_nohz_full_mask, cpumask);
 	tick_nohz_full_running = true;
 }
@@ -643,10 +649,61 @@ static int tick_nohz_cpu_down(unsigned int cpu)
 	return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY;
 }
 
-void __init tick_nohz_init(void)
+static int tick_nohz_housekeeping_reconfigure(struct notifier_block *nb,
+					     unsigned long action, void *data)
+{
+	struct housekeeping_update *upd = data;
+	int cpu;
+
+	if (action == HK_UPDATE_MASK && upd->type == HK_TYPE_TICK) {
+		cpumask_var_t non_housekeeping_mask;
+
+		if (!alloc_cpumask_var(&non_housekeeping_mask, GFP_KERNEL))
+			return NOTIFY_BAD;
+
+		cpumask_andnot(non_housekeeping_mask, cpu_possible_mask, upd->new_mask);
+
+		if (!tick_nohz_full_mask) {
+			if (!zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL)) {
+				free_cpumask_var(non_housekeeping_mask);
+				return NOTIFY_BAD;
+			}
+		}
+
+		/* Kick all CPUs to re-evaluate tick dependency before change */
+		for_each_online_cpu(cpu)
+			tick_nohz_full_kick_cpu(cpu);
+
+		cpumask_copy(tick_nohz_full_mask, non_housekeeping_mask);
+		tick_nohz_full_running = !cpumask_empty(tick_nohz_full_mask);
+
+		/* Kick all CPUs again to apply new nohz full state */
+		for_each_online_cpu(cpu)
+			tick_nohz_full_kick_cpu(cpu);
+
+		free_cpumask_var(non_housekeeping_mask);
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block tick_nohz_housekeeping_nb = {
+	.notifier_call = tick_nohz_housekeeping_reconfigure,
+};
+
+void tick_nohz_init(void)
 {
 	int cpu, ret;
 
+	if (!tick_nohz_full_mask) {
+		if (system_state < SYSTEM_RUNNING)
+			alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
+		else
+			zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL);
+	}
+
+	housekeeping_register_notifier(&tick_nohz_housekeeping_nb);
+
 	if (!tick_nohz_full_running)
 		return;
 

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 11/12] sched/isolation: Implement SMT sibling auto-isolation and safety check
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (9 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 10/12] tick/nohz: Implement dynamic nohz_full state update Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-06  7:04 ` [PATCH RFC 12/12] sched/isolation: Bridge isolcpus and support runtime tick offload init Qiliang Yuan
  2026-02-20 19:07 ` [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Joel Fernandes
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/sched/isolation.c | 72 ++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index d9ce26cf31fe..30798e790b9f 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -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);
 

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH RFC 12/12] sched/isolation: Bridge isolcpus and support runtime tick offload init
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (10 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 11/12] sched/isolation: Implement SMT sibling auto-isolation and safety check Qiliang Yuan
@ 2026-02-06  7:04 ` Qiliang Yuan
  2026-02-20 19:07 ` [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Joel Fernandes
  12 siblings, 0 replies; 16+ messages in thread
From: Qiliang Yuan @ 2026-02-06  7:04 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, 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.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
---
 kernel/sched/core.c      | 5 ++++-
 kernel/sched/isolation.c | 3 +++
 kernel/sched/sched.h     | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 045f83ad261e..d155e1132d6b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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;
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 30798e790b9f..76c039a01fb0 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -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;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 93fce4bbff5e..0079e7210c38 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -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

-- 
2.51.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs
  2026-02-06  7:04 ` [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs Qiliang Yuan
@ 2026-02-06 12:24   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2026-02-06 12:24 UTC (permalink / raw)
  To: Qiliang Yuan, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Valentin Schneider, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, Anna-Maria Behnsen, Ingo Molnar
  Cc: linux-kernel, rcu, linux-mm, Qiliang Yuan, Qiliang Yuan

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

s/Managed IRQs/managed interrupts/ in $subject

> 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

> Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
> Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>

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

> +#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

> +	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'.

> +		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);

                ....

> +			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.

> +				continue;

Thanks,

        tglx


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update
  2026-02-06  7:04 ` [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update Qiliang Yuan
@ 2026-02-06 15:09   ` Zi Yan
  0 siblings, 0 replies; 16+ messages in thread
From: Zi Yan @ 2026-02-06 15:09 UTC (permalink / raw)
  To: Qiliang Yuan
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Tejun Heo, Andrew Morton, Vlastimil Babka,
	Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Anna-Maria Behnsen, Ingo Molnar, linux-kernel,
	rcu, linux-mm, Qiliang Yuan

On 6 Feb 2026, at 2:04, Qiliang Yuan wrote:

> 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.

> Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
> Signed-off-by: Qiliang Yuan <yuanql9@chinatelecom.cn>
> ---
>  mm/compaction.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>


Best Regards,
Yan, Zi


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI)
  2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
                   ` (11 preceding siblings ...)
  2026-02-06  7:04 ` [PATCH RFC 12/12] sched/isolation: Bridge isolcpus and support runtime tick offload init Qiliang Yuan
@ 2026-02-20 19:07 ` Joel Fernandes
  12 siblings, 0 replies; 16+ messages in thread
From: Joel Fernandes @ 2026-02-20 19:07 UTC (permalink / raw)
  To: Qiliang Yuan
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, Thomas Gleixner, Paul E. McKenney,
	Frederic Weisbecker, Neeraj Upadhyay, Josh Triplett, Boqun Feng,
	Uladzislau Rezki, Mathieu Desnoyers, Lai Jiangshan, Zqiang,
	Tejun Heo, Andrew Morton, Vlastimil Babka, Suren Baghdasaryan,
	Michal Hocko, Brendan Jackman, Johannes Weiner, Zi Yan,
	Anna-Maria Behnsen, Ingo Molnar, linux-kernel, rcu, linux-mm,
	Qiliang Yuan

On Fri, Feb 06, 2026 at 02:04:21AM -0500, Qiliang Yuan wrote:
> 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:
[...]
> 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





> 
> Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
> ---
> 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,
> -- 
> Qiliang Yuan <realwujing@gmail.com>
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-02-20 19:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06  7:04 [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 02/12] sched/isolation: Introduce reconfiguration notifier chain Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs Qiliang Yuan
2026-02-06 12:24   ` Thomas Gleixner
2026-02-06  7:04 ` [PATCH RFC 04/12] rcu: Sync RCU housekeeping mask on notification Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 05/12] sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN) Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update Qiliang Yuan
2026-02-06 15:09   ` Zi Yan
2026-02-06  7:04 ` [PATCH RFC 09/12] sched/isolation: Separate housekeeping types and add sysfs interface Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 10/12] tick/nohz: Implement dynamic nohz_full state update Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 11/12] sched/isolation: Implement SMT sibling auto-isolation and safety check Qiliang Yuan
2026-02-06  7:04 ` [PATCH RFC 12/12] sched/isolation: Bridge isolcpus and support runtime tick offload init Qiliang Yuan
2026-02-20 19:07 ` [PATCH RFC 00/12] Implementation of Dynamic Housekeeping & Enhanced Isolation (DHEI) Joel Fernandes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox