2024-04-30 15:21:42

by Vitalii Bursov

[permalink] [raw]
Subject: [PATCH v4 2/3] sched/debug: dump domains' level

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.

SDM macro is not used because sd->level is int and
it would hide the type mismatch between int and u32.

Signed-off-by: Vitalii Bursov <[email protected]>
Acked-by: Vincent Guittot <[email protected]>
Tested-by: Dietmar Eggemann <[email protected]>
---
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);
}

void update_sched_domain_debugfs(void)
--
2.20.1



2024-05-02 16:01:46

by Valentin Schneider

[permalink] [raw]
Subject: Re: [PATCH v4 2/3] sched/debug: dump domains' level

On 30/04/24 18:05, 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.
>
> SDM macro is not used because sd->level is int and
> it would hide the type mismatch between int and u32.
>
> Signed-off-by: Vitalii Bursov <[email protected]>
> Acked-by: Vincent Guittot <[email protected]>
> Tested-by: Dietmar Eggemann <[email protected]>

Reviewed-by: Valentin Schneider <[email protected]>


Subject: [tip: sched/urgent] sched/debug: Dump domains' level

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID: 287372fa39f579a61e17b000aa74c8418d230528
Gitweb: https://git.kernel.org/tip/287372fa39f579a61e17b000aa74c8418d230528
Author: Vitalii Bursov <[email protected]>
AuthorDate: Tue, 30 Apr 2024 18:05:24 +03:00
Committer: Ingo Molnar <[email protected]>
CommitterDate: Fri, 17 May 2024 09:48:25 +02:00

sched/debug: Dump domains' level

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.

SDM macro is not used because sd->level is 'int' and
it would hide the type mismatch between 'int' and 'u32'.

Signed-off-by: Vitalii Bursov <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Tested-by: Dietmar Eggemann <[email protected]>
Acked-by: Vincent Guittot <[email protected]>
Reviewed-by: Valentin Schneider <[email protected]>
Link: https://lore.kernel.org/r/9489b6475f6dd6fbc67c617752d4216fa094da53.1714488502.git.vitaly@bursov.com
---
kernel/sched/debug.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 8d5d98a..c1eb9a1 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);
}

void update_sched_domain_debugfs(void)