* [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk
@ 2021-02-03 4:20 Yue Hu
2021-02-03 9:52 ` Srikar Dronamraju
0 siblings, 1 reply; 4+ messages in thread
From: Yue Hu @ 2021-02-03 4:20 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot
Cc: linux-kernel, huyue2, zbestahu
From: Yue Hu <huyue2@yulong.com>
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.
Signed-off-by: Yue Hu <huyue2@yulong.com>
---
kernel/sched/topology.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 5d3675c..402138c 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk
2021-02-03 4:20 [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk Yue Hu
@ 2021-02-03 9:52 ` Srikar Dronamraju
2021-02-03 10:10 ` Yue Hu
0 siblings, 1 reply; 4+ messages in thread
From: Srikar Dronamraju @ 2021-02-03 9:52 UTC (permalink / raw)
To: Yue Hu
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, linux-kernel, huyue2,
zbestahu, srikar
* Yue Hu <zbestahu@gmail.com> [2021-02-03 12:20:10]:
> From: Yue Hu <huyue2@yulong.com>
>
> 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.
>
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
> kernel/sched/topology.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 5d3675c..402138c 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -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?
> 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()) {
Same as above.
> pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",
> cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
> }
> --
> 1.9.1
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk
2021-02-03 9:52 ` Srikar Dronamraju
@ 2021-02-03 10:10 ` Yue Hu
2021-02-03 10:59 ` Srikar Dronamraju
0 siblings, 1 reply; 4+ messages in thread
From: Yue Hu @ 2021-02-03 10:10 UTC (permalink / raw)
To: Srikar Dronamraju
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, linux-kernel, huyue2,
zbestahu
On Wed, 3 Feb 2021 15:22:56 +0530
Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
> * Yue Hu <zbestahu@gmail.com> [2021-02-03 12:20:10]:
>
> > From: Yue Hu <huyue2@yulong.com>
> >
> > 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.
> >
> > Signed-off-by: Yue Hu <huyue2@yulong.com>
> > ---
> > kernel/sched/topology.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> > index 5d3675c..402138c 100644
> > --- a/kernel/sched/topology.c
> > +++ b/kernel/sched/topology.c
> > @@ -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?
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.
>
> > 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()) {
>
> Same as above.
>
> > pr_info("root domain span: %*pbl (max cpu_capacity
> > = %lu)\n", cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
> > }
> > --
> > 1.9.1
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk
2021-02-03 10:10 ` Yue Hu
@ 2021-02-03 10:59 ` Srikar Dronamraju
0 siblings, 0 replies; 4+ messages in thread
From: Srikar Dronamraju @ 2021-02-03 10:59 UTC (permalink / raw)
To: Yue Hu
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, linux-kernel, huyue2,
zbestahu
* Yue Hu <zbestahu@gmail.com> [2021-02-03 18:10:19]:
> On Wed, 3 Feb 2021 15:22:56 +0530
> Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
>
> > * Yue Hu <zbestahu@gmail.com> [2021-02-03 12:20:10]:
> >
> >
> > 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?
>
> 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.
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-03 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 4:20 [PATCH] sched/topology: Switch to sched_debug() for conditional sched domain printk Yue Hu
2021-02-03 9:52 ` Srikar Dronamraju
2021-02-03 10:10 ` Yue Hu
2021-02-03 10:59 ` Srikar Dronamraju
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).