Re: [PATCH v8 5/9] sched/fair: Take into account latency priority at wakeup

From: Patrick Bellasi
Date: Mon Nov 14 2022 - 11:20:40 EST


Hi Vincent,

On 10-Nov 18:50, Vincent Guittot wrote:

[...]

> diff --git a/init/init_task.c b/init/init_task.c
> index 7dd71dd2d261..b8ddf403bc62 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -78,7 +78,7 @@ struct task_struct init_task
> .prio = MAX_PRIO - 20,
> .static_prio = MAX_PRIO - 20,
> .normal_prio = MAX_PRIO - 20,
> - .latency_nice = DEFAULT_LATENCY_NICE,
> + .latency_prio = NICE_WIDTH - 20,
^^^^^^^^^^

For robustness/consistency, shoudln't this be LATENCY_NICE_WIDTH?

[...]

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b2accc9da4fe..caf54e54a74f 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1284,6 +1284,16 @@ static void set_load_weight(struct task_struct *p, bool update_load)
> }
> }
>
> +static void set_latency_offset(struct task_struct *p)
> +{
> + long weight = sched_latency_to_weight[p->latency_prio];
> + s64 offset;
> +
> + offset = weight * get_sched_latency(false);
^^^^^^^^^^^^^^^^^^^^^^^^
As per my comment in patch 1, we almost always (but one time) call this with
"false" and that's not returning the sysctl_sched_latency but a possibly
discounted value in case of feat(GENTLE_FAIR_SLEEPERS).

Just to avoid confusion (this could be not the sched_latency) and to better
document the code, what about using a accessor define something like e.g.

#define max_wakeup_latency get_wakeup_latency(false)

?

[...]

Best,
Patrick

--
#include <best/regards.h>

Patrick Bellasi