[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191115090939.6ku6cc44iaoanjph@e107158-lin.cambridge.arm.com>
Date: Fri, 15 Nov 2019 09:09:40 +0000
From: Qais Yousef <qais.yousef@....com>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Valentin Schneider <valentin.schneider@....com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dietmar Eggemann <Dietmar.Eggemann@....com>,
Tejun Heo <tj@...nel.org>,
Patrick Bellasi <patrick.bellasi@...bug.net>,
Suren Baghdasaryan <surenb@...gle.com>,
Quentin Perret <qperret@...gle.com>
Subject: Re: [PATCH] sched/uclamp: Fix overzealous type replacement
On 11/15/19 09:12, Vincent Guittot wrote:
> On Wed, 13 Nov 2019 at 17:55, Valentin Schneider
> <valentin.schneider@....com> wrote:
> >
> > Some uclamp helpers had their return type changed from 'unsigned int' to
> > 'enum uclamp_id' by commit
> >
> > 0413d7f33e60 ("sched/uclamp: Always use 'enum uclamp_id' for clamp_id values")
> >
> > but it happens that some *actually* do return an unsigned int value. Those
> > are the helpers that return a utilization value: uclamp_rq_max_value() and
> > uclamp_eff_value(). Fix those up.
> >
> > Note that this doesn't lead to any obj diff using a relatively recent
> > aarch64 compiler (8.3-2019.03). The current code of e.g. uclamp_eff_value()
> > already figures out that the return value is 11 bits (bits_per(1024)) and
> > doesn't seem to do anything funny. I'm still marking this as fixing the
> > above commit to be on the safe side.
> >
> > Fixes: 0413d7f33e60 ("sched/uclamp: Always use 'enum uclamp_id' for clamp_id values")
> > Signed-off-by: Valentin Schneider <valentin.schneider@....com>
> > ---
> > kernel/sched/core.c | 4 ++--
> > kernel/sched/sched.h | 2 +-
> > 2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 513a4794ff36..71a45025cd2e 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -853,7 +853,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id,
> > }
> >
> > static inline
> > -enum uclamp_id uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id,
> > +unsigned int uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id,
> > unsigned int clamp_value)
> > {
> > struct uclamp_bucket *bucket = rq->uclamp[clamp_id].bucket;
> > @@ -918,7 +918,7 @@ uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id)
> > return uc_req;
> > }
> >
> > -enum uclamp_id uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
> > +unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
> > {
> > struct uclamp_se uc_eff;
> >
>
> And static inline enum uclamp_id uclamp_none(enum uclamp_id clamp_id) ?
>
> Should it be fixed as well as it can return SCHED_CAPACITY_SCALE ?
Indeed. That should return unsigned int too as it's returning the uclamp value.
Thanks
--
Qais Yousef
Powered by blists - more mailing lists