sched/topology: Switch to sched_debug() for conditional sched domain printk
PATCH 1/1 sched/topology: Switch to sched_debug() for conditional sched domain printk
From: Yue Hu <[email protected]>
Currently, the macro sched_debug_enabled has same function as sched_debug() with return false for !SCHED_DEBUG. And sched_debug() is a wapper of variable sched_debug_enabled for SCHED_DEBUG. We can use the sched_debug() for all cases. So, let's remove the unnecessary marco, also use sched_debug() in sched_domain_debug() for code consistency.
--- kernel/sched/topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/sched/topology.c +2 -3
@@ -131,7 +131,7 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) {int level =0 ; -if (!sched_debug_enabled) +if (!sched_debug ())return ;if (!sd) {
@@ -152,7 +152,6 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) }#else /* !CONFIG_SCHED_DEBUG */ -# define sched_debug_enabled 0# define sched_domain_debug (sd, cpu) do { } while (0)static inline bool sched_debug (void ) {
@@ -2113,7 +2112,7 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl,if (has_asym)static_branch_inc_cpuslocked (&sched_asym_cpucapacity); -if (rq && sched_debug_enabled) { +if (rq &&sched_debug ()) {pr_info ("root domain span: %*pbl (max cpu_capacity = %lu)\n" ,cpumask_pr_args (cpu_map), rq->rd->max_cpu_capacity); }
Signature · 1 line
1.9.1
Quoted 19 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the macro
sched_debug_enabledhas same function assched_debug()with return false for !SCHED_DEBUG. Andsched_debug()is a wapper of variablesched_debug_enabledforSCHED_DEBUG. We can use thesched_debug()for all cases. So, let's remove the unnecessary marco, also usesched_debug()insched_domain_debug()for code consistency.Signed-off-by Yue Hu <[email protected]>--- kernel/sched/topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)kernel/sched/topology.c +0
-0
kernel/sched/topology.c static void sched_domain_debug(struct sched_domain *sd, int cpu) · line 136
Quoted 7 lines
kernel/sched/topology.c +1
-1@@ -131,7 +131,7 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) {int level =0 ; -if (!sched_debug_enabled) +if (!sched_debug ())return ;
sched_debug() would only be present in CONFIG_SCHED_DEBUG. Right? In which case there would be a build failure with your change in !CONFIG_SCHED_DEBUG config.
or Am I missing something?
Quoted 10 lines
kernel/sched/topology.c +0
-1if (!sd) {@@ -152,7 +152,6 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) }#else /* !CONFIG_SCHED_DEBUG */ -# define sched_debug_enabled 0# define sched_domain_debug (sd, cpu) do { } while (0)static inline bool sched_debug (void ) {
kernel/sched/topology.c static bool topology_span_sane(struct sched_domain_topology_level *tl, · line 2115
Quoted 5 lines
kernel/sched/topology.c +1
-1@@ -2113,7 +2112,7 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl,if (has_asym)static_branch_inc_cpuslocked (&sched_asym_cpucapacity); -if (rq && sched_debug_enabled) { +if (rq &&sched_debug ()) {
Same as above.
Quoted 6 lines
kernel/sched/topology.c +0
-0pr_info ("root domain span: %*pbl (max cpu_capacity = %lu)\n" ,cpumask_pr_args (cpu_map), rq->rd->max_cpu_capacity); }Signature · 1 line
1.9.1
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
Quoted 33 lines · On Wed, 3 Feb 2021 15:22:56 +0530 Srikar Dronamraju…
Quoted 19 lines · Yue Hu
From: Yue Hu <[email protected]>
Currently, the macro
sched_debug_enabledhas same function assched_debug()with return false for !SCHED_DEBUG. Andsched_debug()is a wapper of variablesched_debug_enabledforSCHED_DEBUG. We can use thesched_debug()for all cases. So, let's remove the unnecessary marco, also usesched_debug()insched_domain_debug()for code consistency.Signed-off-by Yue Hu <[email protected]>--- kernel/sched/topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)kernel/sched/topology.c +0
-0kernel/sched/topology.c static void sched_domain_debug(struct · line 136
Quoted 7 lines
kernel/sched/topology.c +1
-1@@ -131,7 +131,7 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) { int level = 0; -if (!sched_debug_enabled) +if (!sched_debug ())return ;
sched_debug()would only be present inCONFIG_SCHED_DEBUG. Right? In which case there would be a build failure with your change in !CONFIG_SCHED_DEBUG config.
Quoted 1 line
or Am I missing something?
sched_debug() is also defined for !CONFIG_SCHED_DEBUG as below:
static inline bool sched_debug(void)
{
return false;
}And I think define sched_debug() above is just to avoid CONFIG_SCHED_DEBUG wrappery.
Quoted 26 lines
Quoted 11 lines
kernel/sched/topology.c +0
-1if (!sd) {@@ -152,7 +152,6 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) }#else /* !CONFIG_SCHED_DEBUG */ -# define sched_debug_enabled 0# define sched_domain_debug (sd, cpu) do { } while (0)static inline bool sched_debug (void ) {kernel/sched/topology.c static bool topology_span_sane(struct · line 2115
Quoted 5 lines
kernel/sched/topology.c +1
-1@@ -2113,7 +2112,7 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl, if (has_asym) static_branch_inc_cpuslocked(&sched_asym_cpucapacity); -if (rq && sched_debug_enabled) { +if (rq &&sched_debug ()) {Same as above.
Quoted 6 lines
kernel/sched/topology.c +0
-0pr_info ("root domain span: %*pbl (max cpu_capacity = %lu)\n", cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity); }Signature · 1 line
1.9.1
Quoted 10 lines · Yue Hu
Quoted 7 lines · On Wed, 3 Feb 2021 15:22:56 +0530 Srikar Dronamraju…
* Yue Hu <[email protected]> [2021-02-03 12:20:10]:
sched_debug()would only be present inCONFIG_SCHED_DEBUG. Right? In which case there would be a build failure with your change in !CONFIG_SCHED_DEBUG config.
Quoted 9 lines
Quoted 1 line
or Am I missing something?
sched_debug()is also defined for !CONFIG_SCHED_DEBUG as below:static inline bool
sched_debug(void){ return false; }
ah .. right .. somehow I missed this.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju