As housekeeping cpumasks can now be modified at run time, we need a way
to examine the their current values to see if they meet our expectation.
Add a new sched debugfs file "housekeeping_cpumasks" to dump out the
current values.

Signed-off-by: Waiman Long <[email protected]>
---
 kernel/sched/debug.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 3f06ab84d53f..ba8f0334c15e 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -490,6 +490,35 @@ static void debugfs_fair_server_init(void)
        }
 }
 
+#ifdef CONFIG_CPU_ISOLATION
+static int hk_cpumasks_show(struct seq_file *m, void *v)
+{
+       static const char * const hk_type_name[HK_TYPE_MAX] = {
+               [HK_TYPE_DOMAIN]        = "domain",
+               [HK_TYPE_MANAGED_IRQ]   = "managed_irq",
+               [HK_TYPE_KERNEL_NOISE]  = "nohz_full"
+       };
+       int type;
+
+       for (type = 0; type < HK_TYPE_MAX; type++)
+               seq_printf(m, "%s: %*pbl\n", hk_type_name[type],
+                          cpumask_pr_args(housekeeping_cpumask(type)));
+       return 0;
+}
+
+static int hk_cpumasks_open(struct inode *inode, struct file *filp)
+{
+       return single_open(filp, hk_cpumasks_show, NULL);
+}
+
+static const struct file_operations hk_cpumasks_fops = {
+       .open           = hk_cpumasks_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+#endif
+
 static __init int sched_init_debug(void)
 {
        struct dentry __maybe_unused *numa;
@@ -525,6 +554,9 @@ static __init int sched_init_debug(void)
        debugfs_create_u32("hot_threshold_ms", 0644, numa, 
&sysctl_numa_balancing_hot_threshold);
 #endif /* CONFIG_NUMA_BALANCING */
 
+#ifdef CONFIG_CPU_ISOLATION
+       debugfs_create_file("housekeeing_cpumasks", 0444, debugfs_sched, NULL, 
&hk_cpumasks_fops);
+#endif
        debugfs_create_file("debug", 0444, debugfs_sched, NULL, 
&sched_debug_fops);
 
        debugfs_fair_server_init();
-- 
2.50.0


Reply via email to