Re: [PATCH 8/8] sched,fair: flatten hierarchical runqueues

From: Dietmar Eggemann
Date: Tue Jun 25 2019 - 05:50:29 EST


On 6/12/19 9:32 PM, Rik van Riel wrote:

[...]

> @@ -410,6 +412,11 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se)
> return se->parent;
> }
>
> +static inline bool task_se_in_cgroup(struct sched_entity *se)
> +{
> + return parent_entity(se);
> +}

IMHO, s/in_cgroup/not_in_root_tg/ reads easier. "/", i.e. the root tg is
still a cgroup, I guess. But you could use existing parent_entity(se) as
well.

[...]

> @@ -679,22 +710,16 @@ static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
> static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
> {
> u64 slice = sysctl_sched_latency;
> + struct load_weight *load = &cfs_rq->load;
> + struct load_weight lw;
>
> - for_each_sched_entity(se) {
> - struct load_weight *load;
> - struct load_weight lw;
> + if (unlikely(!se->on_rq)) {
> + lw = cfs_rq->load;
>
> - cfs_rq = cfs_rq_of(se);
> - load = &cfs_rq->load;
> -
> - if (unlikely(!se->on_rq)) {
> - lw = cfs_rq->load;
> -
> - update_load_add(&lw, se->load.weight);
> - load = &lw;
> - }
> - slice = __calc_delta(slice, se->load.weight, load);
> + update_load_add(&lw, task_se_h_load(se));
> + load = &lw;
> }
> + slice = __calc_delta(slice, task_se_h_load(se), load);

task_se_h_load(se) and se->load.weight are off my factor of >= 1024 on
64bit.

...
bash pid=3250: task_se_h_load(se)=1023 se->load.weight=1048576
sysctl_sched_latency=18000000 slice=0 old_slice=17999995
...

[...]