Re: [PATCH 1/2] sched/uclamp: Add a new sysctl to control RT default boost value

From: Quentin Perret
Date: Wed Apr 15 2020 - 06:12:37 EST


Hi Qais,

On Friday 03 Apr 2020 at 13:30:19 (+0100), Qais Yousef wrote:
<snip>
> + /*
> + * The new value will be applied to all RT tasks the next time they
> + * wakeup, assuming the task is using the system default and not a user
> + * specified value. In the latter we shall leave the value as the user
> + * requested.
> + */
> if (sysctl_sched_uclamp_util_min > sysctl_sched_uclamp_util_max ||
> sysctl_sched_uclamp_util_max > SCHED_CAPACITY_SCALE) {
> result = -EINVAL;
> goto undo;
> }
>
> + if (sysctl_sched_rt_default_uclamp_util_min > SCHED_CAPACITY_SCALE) {
> + result = -EINVAL;
> + goto undo;
> + }

Hmm, checking:

if (sysctl_sched_rt_default_uclamp_util_min > sysctl_sched_uclamp_util_min)

would probably make sense too, but then that would make writing in
sysctl_sched_uclamp_util_min cumbersome for sysadmins as they'd need to
lower the rt default first. Is that the reason for checking against
SCHED_CAPACITY_SCALE? That might deserve a comment or something.

<snip>
> @@ -1241,9 +1293,13 @@ static void uclamp_fork(struct task_struct *p)
> for_each_clamp_id(clamp_id) {
> unsigned int clamp_value = uclamp_none(clamp_id);
>
> - /* By default, RT tasks always get 100% boost */
> + /*
> + * By default, RT tasks always get 100% boost, which the admins
> + * are allowed to change via
> + * sysctl_sched_rt_default_uclamp_util_min knob.
> + */
> if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN))
> - clamp_value = uclamp_none(UCLAMP_MAX);
> + clamp_value = sysctl_sched_rt_default_uclamp_util_min;
>
> uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false);
> }

And that, as per 20200414161320.251897-1-qperret@xxxxxxxxxx, should not
be there :)

Otherwise the patch pretty looks good to me!

Thanks,
Quentin