mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
sched/uclamp: Make uclamp util helpers use and return UL values
Vincent pointed out recently that the canonical type for utilization values is 'unsigned long'. Internally uclamp uses 'unsigned int' values for cache optimization, but this doesn't have to be exported to its users. Make the uclamp helpers that deal with utilization use and return unsigned long values. Tested-By: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Quentin Perret <qperret@google.com> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20191211113851.24241-3-valentin.schneider@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
59fe675248
commit
686516b55e
@ -919,17 +919,17 @@ uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id)
|
|||||||
return uc_req;
|
return uc_req;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
|
unsigned long uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
|
||||||
{
|
{
|
||||||
struct uclamp_se uc_eff;
|
struct uclamp_se uc_eff;
|
||||||
|
|
||||||
/* Task currently refcounted: use back-annotated (effective) value */
|
/* Task currently refcounted: use back-annotated (effective) value */
|
||||||
if (p->uclamp[clamp_id].active)
|
if (p->uclamp[clamp_id].active)
|
||||||
return p->uclamp[clamp_id].value;
|
return (unsigned long)p->uclamp[clamp_id].value;
|
||||||
|
|
||||||
uc_eff = uclamp_eff_get(p, clamp_id);
|
uc_eff = uclamp_eff_get(p, clamp_id);
|
||||||
|
|
||||||
return uc_eff.value;
|
return (unsigned long)uc_eff.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2300,14 +2300,14 @@ 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
|
||||||
unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id);
|
unsigned long 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 long uclamp_util_with(struct rq *rq, unsigned long util,
|
||||||
struct task_struct *p)
|
struct task_struct *p)
|
||||||
{
|
{
|
||||||
unsigned int min_util = READ_ONCE(rq->uclamp[UCLAMP_MIN].value);
|
unsigned long min_util = READ_ONCE(rq->uclamp[UCLAMP_MIN].value);
|
||||||
unsigned int max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value);
|
unsigned long max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value);
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
min_util = max(min_util, uclamp_eff_value(p, UCLAMP_MIN));
|
min_util = max(min_util, uclamp_eff_value(p, UCLAMP_MIN));
|
||||||
@ -2325,8 +2325,8 @@ unsigned int uclamp_util_with(struct rq *rq, unsigned int util,
|
|||||||
return clamp(util, min_util, max_util);
|
return clamp(util, min_util, max_util);
|
||||||
}
|
}
|
||||||
#else /* CONFIG_UCLAMP_TASK */
|
#else /* CONFIG_UCLAMP_TASK */
|
||||||
static inline unsigned int uclamp_util_with(struct rq *rq, unsigned int util,
|
static inline unsigned long uclamp_util_with(struct rq *rq, unsigned long util,
|
||||||
struct task_struct *p)
|
struct task_struct *p)
|
||||||
{
|
{
|
||||||
return util;
|
return util;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user