Re: [PATCH v2 1/1] sched/uclamp: add SCHED_FLAG_UTIL_CLAMP_RESET flag to reset uclamp
From: Dietmar Eggemann
Date: Thu Oct 15 2020 - 07:55:23 EST
On 14/10/2020 16:50, Patrick Bellasi wrote:
>
> On Tue, Oct 13, 2020 at 22:25:48 +0200, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote...
[...]
>> On 12/10/2020 18:31, Yun Hsiang wrote:
[...]
> Not sure what's the specific use-case Yun is after, but I have at least
> one in my mind.
>
> Let say a task does not need boost at all, independently from
> the cgroup it's configured to run into. We can go on and set its task
> specific value to util_min=0.
>
> In this case, when the task is running alone on a CPU, it will get
> always the minimum OPP, independently from its utilization.
>
> Now, after a while (e.g. some special event happens) we want to relax
> this constraint and allow the task to run:
> 1. at whatever OPP is required by its utilization
> 2. with any additional boost possibly enforced by its cgroup
>
> Right now we have only quite cumbersome or hack solution:
> a) go check the current cgroup util_min value and set for the task
> something higher than that
IMHO, it's not only the current taskgroup. You would have to check the
whole hierarchy (including system-wide).
> b) set task::util_min=1024 thus asking for the maximum possible boost
>
> Solution a) is more code for userspace and it's also racy. Solution b)
> is misleading since the task does not really want to run at 1024.
> It's also potentially over-killing in case the task should be moved to
> the root group, which is normally unbounded and thus the task will get
> executed always at the max OPP without any specific reason why.
>
> A simple _UCLAMP_RESET flag will allow user-space to easily switch a
> tasks to the default behavior (follow utilization or recommended
> boosts) which is what a task usually gets when it does not opt-in to
> uclamp.
OK, so restricting (eclipsing) 'user_defined' task uclamp values to
taskgroup (hierarchy) values by setting the task value > the taskgroup
(hierarchy) value is cumbersome.
A task uclamp reset function will force this 'user_defined' task
automatically under taskgroup (hierarchy) control by turning it into a
'!user_defined' task again.
... and this will facilitate easier uclamp userspace controller.