public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Jason Yan <yanaijie@huawei.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Return true,false in voluntary_active_balance()
Date: Thu, 07 May 2020 12:17:36 +0100	[thread overview]
Message-ID: <jhjpnbg6lkf.mognet@arm.com> (raw)
In-Reply-To: <20200507110625.37254-1-yanaijie@huawei.com>


On 07/05/20 12:06, Jason Yan wrote:
> Fix the following coccicheck warning:
>
> kernel/sched/fair.c:9375:9-10: WARNING: return of 0/1 in function
> 'voluntary_active_balance' with return type bool
>

It's perfectly safe to return 0/1 in a boolean function; that said seeing
as this is the second attempt at "fixing" this I'm tempted to say we should
pick it up...

> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> ---
>  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 b3bb4d6e49c3..e8390106ada4 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9373,7 +9373,7 @@ voluntary_active_balance(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.
> @@ -9385,13 +9385,13 @@ voluntary_active_balance(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)

  reply	other threads:[~2020-05-07 11:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 11:06 [PATCH] sched/fair: Return true,false in voluntary_active_balance() Jason Yan
2020-05-07 11:17 ` Valentin Schneider [this message]
2020-05-07 17:28   ` Steven Rostedt
2020-05-07 17:30     ` Steven Rostedt
2020-05-07 17:52       ` Valentin Schneider
2020-05-07 17:55       ` Joe Perches
2020-05-07 18:45         ` Steven Rostedt
2020-05-07 19:06           ` Joe Perches
2020-05-07 19:45             ` Steven Rostedt
2020-05-07 20:18               ` Joe Perches
2020-05-08  8:16 ` Peter Zijlstra
2020-05-08  9:06   ` Rasmus Villemoes
2020-05-08  9:24   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jhjpnbg6lkf.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=yanaijie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox