Commit 7763baac authored by Valentin Schneider's avatar Valentin Schneider Committed by Ingo Molnar

sched/uclamp: Fix overzealous type replacement

Some uclamp helpers had their return type changed from 'unsigned int' to
'enum uclamp_id' by commit

  0413d7f3 ("sched/uclamp: Always use 'enum uclamp_id' for clamp_id values")

but it happens that some do return a value in the [0, SCHED_CAPACITY_SCALE]
range, which should really be unsigned int. The affected helpers are
uclamp_none(), 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()
properly returns an 11 bit value (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.
Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
Reviewed-by: default avatarQais Yousef <qais.yousef@arm.com>
Acked-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar.Eggemann@arm.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: patrick.bellasi@matbug.net
Cc: qperret@google.com
Cc: surenb@google.com
Cc: tj@kernel.org
Fixes: 0413d7f3 ("sched/uclamp: Always use 'enum uclamp_id' for clamp_id values")
Link: https://lkml.kernel.org/r/20191115103908.27610-1-valentin.schneider@arm.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a0e813f2
...@@ -810,7 +810,7 @@ static inline unsigned int uclamp_bucket_base_value(unsigned int clamp_value) ...@@ -810,7 +810,7 @@ static inline unsigned int uclamp_bucket_base_value(unsigned int clamp_value)
return UCLAMP_BUCKET_DELTA * uclamp_bucket_id(clamp_value); return UCLAMP_BUCKET_DELTA * uclamp_bucket_id(clamp_value);
} }
static inline enum uclamp_id uclamp_none(enum uclamp_id clamp_id) static inline unsigned int uclamp_none(enum uclamp_id clamp_id)
{ {
if (clamp_id == UCLAMP_MIN) if (clamp_id == UCLAMP_MIN)
return 0; return 0;
...@@ -853,7 +853,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id, ...@@ -853,7 +853,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id,
} }
static inline 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) unsigned int clamp_value)
{ {
struct uclamp_bucket *bucket = rq->uclamp[clamp_id].bucket; 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) ...@@ -918,7 +918,7 @@ uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id)
return uc_req; 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; struct uclamp_se uc_eff;
......
...@@ -2300,7 +2300,7 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {} ...@@ -2300,7 +2300,7 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {}
#endif /* CONFIG_CPU_FREQ */ #endif /* CONFIG_CPU_FREQ */
#ifdef CONFIG_UCLAMP_TASK #ifdef CONFIG_UCLAMP_TASK
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);
static __always_inline static __always_inline
unsigned int uclamp_util_with(struct rq *rq, unsigned int util, unsigned int uclamp_util_with(struct rq *rq, unsigned int util,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment