[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201016093503.GG2611@hirez.programming.kicks-ass.net>
Date: Fri, 16 Oct 2020 11:35:03 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: zhout <ouwen210@...mail.com>, g@...ez.programming.kicks-ass.net
Cc: tglx@...utronix.de, mingo@...nel.org, linux-kernel@...r.kernel.org,
bigeasy@...utronix.de, qais.yousef@....com, swood@...hat.com,
valentin.schneider@....com, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vincent.donnefort@....com, tj@...nel.org
Subject: Re: [PATCH v3 11/19] sched/core: Make migrate disable and CPU
hotplug cooperative
On Fri, Oct 16, 2020 at 11:43:17AM +0800, zhout wrote:
> On Thu, Oct 15, 2020 at 01:05:43PM +0200, Peter Zijlstra wrote:
> > From: Thomas Gleixner <tglx@...utronix.de>
> >
>
> [ ... ]
>
> > +static inline bool rq_has_pinned_tasks(struct rq *rq)
> > +{
> > + return rq->nr_pinned;
> > +}
> > +
>
> Even I do not understand well enough, the return type of the
> above function is bool and rq->nr_pinned is unsigned int.
> Write this way:
>
> static inline bool rq_has_pinned_tasks(struct rq *rq)
> {
> return !!rq->nr_pinned;
> }
The C compiler does this for us. C has a lot of implicit type
conversions.
It is the same mechanism at work when we write:
if (rq->nr_pinned)
We know that works and we don't have to write:
if (!!rq->nr_pinned)
(although we may, but it is pointless).
Powered by blists - more mailing lists