Skip to content

Commit

Permalink
sched_ext: Start schedulers with consistent p->scx.slice values
Browse files Browse the repository at this point in the history
The disable path caps p->scx.slice to SCX_SLICE_DFL. As the field is already
being ignored at this stage during disable, the only effect this has is that
when the next BPF scheduler is loaded, it won't see unreasonable left-over
slices. Ultimately, this shouldn't matter but it's better to start in a
known state. Drop p->scx.slice capping from the disable path and instead
reset it to SCX_SLICE_DFL in the enable path.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: David Vernet <[email protected]>
  • Loading branch information
htejun committed Oct 10, 2024
1 parent 54baa7a commit 3fdb9eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -4473,7 +4473,6 @@ static void scx_ops_disable_workfn(struct kthread_work *work)

sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);

p->scx.slice = min_t(u64, p->scx.slice, SCX_SLICE_DFL);
__setscheduler_prio(p, p->prio);
check_class_changing(task_rq(p), p, old_class);

Expand Down Expand Up @@ -5190,6 +5189,7 @@ static int scx_ops_enable(struct sched_ext_ops *ops, struct bpf_link *link)

sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);

p->scx.slice = SCX_SLICE_DFL;
__setscheduler_prio(p, p->prio);
check_class_changing(task_rq(p), p, old_class);

Expand Down

0 comments on commit 3fdb9eb

Please sign in to comment.