Re: [PATCH v3 2/3] sched/debug: dump domains' level
From: Valentin Schneider
Date: Thu Apr 04 2024 - 10:24:34 EST
On 03/04/24 16:28, Vitalii Bursov wrote:
> Knowing domain's level exactly can be useful when setting
> relax_domain_level or cpuset.sched_relax_domain_level
>
> Usage:
> cat /debug/sched/domains/cpu0/domain1/level
> to dump cpu0 domain1's level.
>
> Signed-off-by: Vitalii Bursov <vitaly@xxxxxxxxxx>
> ---
> kernel/sched/debug.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index 8d5d98a5834d..c1eb9a1afd13 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -425,6 +425,7 @@ static void register_sd(struct sched_domain *sd, struct dentry *parent)
>
> debugfs_create_file("flags", 0444, parent, &sd->flags, &sd_flags_fops);
> debugfs_create_file("groups_flags", 0444, parent, &sd->groups->flags, &sd_flags_fops);
> + debugfs_create_u32("level", 0444, parent, (u32 *)&sd->level);
How about reusing the SDM macro? ->flags and ->groups_flags get special
treatment for pretty printing, but the others don't need that.
---
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index c1eb9a1afd13e..f97902208b34d 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -419,13 +419,13 @@ static void register_sd(struct sched_domain *sd, struct dentry *parent)
SDM(u32, 0644, busy_factor);
SDM(u32, 0644, imbalance_pct);
SDM(u32, 0644, cache_nice_tries);
+ SDM(u32, 0444, level);
SDM(str, 0444, name);
#undef SDM
debugfs_create_file("flags", 0444, parent, &sd->flags, &sd_flags_fops);
debugfs_create_file("groups_flags", 0444, parent, &sd->groups->flags, &sd_flags_fops);
- debugfs_create_u32("level", 0444, parent, (u32 *)&sd->level);
}
void update_sched_domain_debugfs(void)