Re: [RFC PATCH 6/6] sched/uclamp: Simplify uclamp_eff_value()

From: Dietmar Eggemann
Date: Fri Nov 03 2023 - 10:50:32 EST


On 04/10/2023 11:04, Hongyan Xia wrote:
> From: Hongyan Xia <hongyan.xia2@xxxxxxx>
>
> The commit
>
> sched: Remove all uclamp bucket logic
>
> removes uclamp_{inc/dec}() functions, so now p->uclamp contains the

s/uclamp_{inc/dec}/uclamp_rq_{inc/dec}

> correct values all the time after a update_uclamp_active() call, and

s/update_uclamp_active()/uclamp_update_active()

> there's no need to toggle the boolean `active` after an update. As a
> result, this function is fairly simple now and can live as a static
> inline function.

[...]

> -unsigned long uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
> -{
> - if (!uclamp_is_used() || !p->uclamp[clamp_id].active)
> - return uclamp_none(clamp_id);
> -
> - return p->uclamp[clamp_id].value;
> -}
> -

Is there still a need for p->uclamp[clamp_id].active ? Does
uclamp_eff_value() ever get called with !active ?

And why do we have to set uclamp default values in case (!used ||
!active)? Shouldn't they be set already in this situation?

[...]