Re: [PATCH v5 3/4] sched: Allow sched_{get,set}attr to change latency_nice of the task
From: Dietmar Eggemann
Date: Mon May 11 2020 - 07:13:13 EST
On 28/02/2020 10:07, Parth Shah wrote:
> Introduce the latency_nice attribute to sched_attr and provide a
> mechanism to change the value with the use of sched_setattr/sched_getattr
> syscall.
>
> Also add new flag "SCHED_FLAG_LATENCY_NICE" to hint the change in
> latency_nice of the task on every sched_setattr syscall.
>
> Signed-off-by: Parth Shah <parth@xxxxxxxxxxxxx>
> Reviewed-by: Qais Yousef <qais.yousef@xxxxxxx>
[...]
ndif /* _UAPI_LINUX_SCHED_TYPES_H */
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 866ea3d2d284..cd1fb9c8be26 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4710,6 +4710,9 @@ static void __setscheduler_params(struct task_struct *p,
> p->rt_priority = attr->sched_priority;
> p->normal_prio = normal_prio(p);
> set_load_weight(p, true);
> +
> + if (attr->sched_flags & SCHED_FLAG_LATENCY_NICE)
> + p->latency_nice = attr->sched_latency_nice;
> }
How do you make sure that p->latency_nice can be set independently from
p->static_prio?
AFAICS, util_clamp achieves this by relying on SCHED_FLAG_KEEP_PARAMS,
so completely bypassing __setscheduler_params() and using it's own
__setscheduler_uclamp().
[...]