Re: [PATCH 6/6 v3] sched/eevdf: Speedup short slice task scheduling
From: K Prateek Nayak
Date: Thu Jun 25 2026 - 23:58:07 EST
Hello Peter,
On 6/26/2026 3:58 AM, Peter Zijlstra wrote:
> +static u64 ineligible_vruntime(struct cfs_rq *cfs_rq)
> +{
> + struct sched_entity *curr = cfs_rq->curr;
> + long weight = cfs_rq->sum_weight;
> + s64 delta = 0;
> +
> + if (curr && !curr->on_rq)
> + curr = NULL;
> +
> + /*
> + * This is called from set_next_task_fair(.first=true) /
> + * set_protect_slice() so curr had better be set and on_rq.
> + */
> + WARN_ON_ONCE(!curr);
set_protect_slice() is indeed called from set_next_entity(.first=true)
but it is done after __dequeue_entity() and before "cfs_rq->curr" is
set (both sched/flat and sched/core have the same pattern).
You should be hitting this splat very easily unless you have moved
set_protect_slice() after the setting of cfs_rq->curr in your tree.
> +
> + if (weight) {
> + s64 runtime = cfs_rq->sum_w_vruntime;
> +
> + /*
> + * Do not add @curr to obtain the effective '- w_j' terms.
> + */
> +
> + /* sign flips effective floor / ceiling */
> + if (runtime < 0)
> + runtime -= (weight - 1);
> +
> + delta = div64_long(runtime, weight);
> + }
> +
> + return cfs_rq->zero_vruntime + delta + 1;
> +}
> +
> static inline u64 cfs_rq_max_slice(struct cfs_rq *cfs_rq);
>
> /*
> @@ -1058,8 +1119,14 @@ static inline void set_protect_slice(str
> slice = cfs_rq_min_slice(cfs_rq);
>
> slice = min(slice, se->slice);
> - if (slice != se->slice)
> - vprot = min_vruntime(vprot, se->vruntime + calc_delta_fair(slice, se));
> +
> + /* If there are shorter slices than se's one */
> + if (slice != se->slice) {
I guess that condition was protecting a simple boot test but If I run:
for i in 10000000 20000000 30000000 40000000 50000000;
do
sudo taskset -c 0 chrt -v -o -T $i 0 loop& # Simple while(1) loop
done
I see the splat:
------------[ cut here ]------------
!curr
WARNING: kernel/sched/fair.c:858 at set_next_task_fair+0x1d1/0x870, CPU#0: kworker/0:5/3750
...
> + if (sched_feat(PREEMPT_SHORT))
> + vprot = min_vruntime(vprot, ineligible_vruntime(cfs_rq));
> + else
> + vprot = min_vruntime(vprot, se->vruntime + calc_delta_fair(slice, se));
> + }
>
> se->vprot = vprot;
> }
--
Thanks and Regards,
Prateek