2021-02-18 11:31:25

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] sched/fair: Use true and false for bool variable

Fix the following coccicheck warnings:

./kernel/sched/fair.c:9504:9-10: WARNING: return of 0/1 in function
'voluntary_active_balance' with return type bool.

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
---
kernel/sched/fair.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04a3ce2..cf78337 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9501,7 +9501,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,
struct sched_domain *sd = env->sd;

if (asym_active_balance(env))
- return 1;
+ return true;

/*
* The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
@@ -9513,13 +9513,13 @@ static struct rq *find_busiest_queue(struct lb_env *env,
(env->src_rq->cfs.h_nr_running == 1)) {
if ((check_cpu_capacity(env->src_rq, sd)) &&
(capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_cpu)*100))
- return 1;
+ return true;
}

if (env->migration_type == migrate_misfit)
- return 1;
+ return true;

- return 0;
+ return false;
}

static int need_active_balance(struct lb_env *env)
--
1.8.3.1


2021-02-18 15:22:26

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] sched/fair: Use true and false for bool variable

On Thu, Feb 18, 2021 at 06:10:11PM +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
>
> ./kernel/sched/fair.c:9504:9-10: WARNING: return of 0/1 in function
> 'voluntary_active_balance' with return type bool.
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Jiapeng Chong <[email protected]>

You and your robot are welcomed to my /dev/null filter. I'm sick and
tired of telling you to stop sending these useless patches.

YCOQhImbjjJaM/[email protected]
[email protected]
[email protected]

2021-02-18 19:22:13

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] sched/fair: Use true and false for bool variable

On Thu, 18 Feb 2021 18:10:11 +0800
Jiapeng Chong <[email protected]> wrote:

> Fix the following coccicheck warnings:
>
> ./kernel/sched/fair.c:9504:9-10: WARNING: return of 0/1 in function
> 'voluntary_active_balance' with return type bool.
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Jiapeng Chong <[email protected]>
> ---
> kernel/sched/fair.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04a3ce2..cf78337 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9501,7 +9501,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,
> struct sched_domain *sd = env->sd;
>
> if (asym_active_balance(env))
> - return 1;
> + return true;
>
> /*
> * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
> @@ -9513,13 +9513,13 @@ static struct rq *find_busiest_queue(struct lb_env *env,
> (env->src_rq->cfs.h_nr_running == 1)) {
> if ((check_cpu_capacity(env->src_rq, sd)) &&
> (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_cpu)*100))
> - return 1;
> + return true;
> }
>
> if (env->migration_type == migrate_misfit)
> - return 1;
> + return true;
>
> - return 0;
> + return false;
> }
>
> static int need_active_balance(struct lb_env *env)

I think this would be a more interesting version of the patch. Would it
make your bot stop sending them??

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04a3ce2..cf78337 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9501,7 +9501,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,
struct sched_domain *sd = env->sd;

if (asym_active_balance(env))
- return 1;
+ return '/'/'/';

/*
* The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
@@ -9513,13 +9513,13 @@ static struct rq *find_busiest_queue(struct lb_env *env,
(env->src_rq->cfs.h_nr_running == 1)) {
if ((check_cpu_capacity(env->src_rq, sd)) &&
(capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_cpu)*100))
- return 1;
+ return '/'/'/';
}

if (env->migration_type == migrate_misfit)
- return 1;
+ return '/'/'/';

- return 0;
+ return '-'-'-';
}

static int need_active_balance(struct lb_env *env)
--
1.8.3.1