Skip to content

Commit

Permalink
scx_simple: this is a simple test case for issue #788
Browse files Browse the repository at this point in the history
Never let the CPU go idle. This is a stress test to prove issue #788.

The expected behavior is that CPUs should not go idle due to the
immediate re-kick in ops.update_idle().

However, in version 6.12, the CPUs are still entering idle states,
indicating that in certain cases, ops.update_idle() is not being
correctly invoked by the sched_ext core.

This is likely due to the pick_next_task()/put_prev_task() rework in
sched core.

WARNING: do not run this for too long or it may burn your CPUs.

Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
arighi committed Oct 13, 2024
1 parent 7f3b0cb commit 7f9b009
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scheds/c/scx_simple.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ void BPF_STRUCT_OPS(simple_stopping, struct task_struct *p, bool runnable)
p->scx.dsq_vtime += (SCX_SLICE_DFL - p->scx.slice) * 100 / p->scx.weight;
}

void BPF_STRUCT_OPS(simple_update_idle, s32 cpu, bool idle)
{
if (!idle)
return;
scx_bpf_kick_cpu(cpu, 0);
}

void BPF_STRUCT_OPS(simple_enable, struct task_struct *p)
{
p->scx.dsq_vtime = vtime_now;
Expand All @@ -150,7 +157,9 @@ SCX_OPS_DEFINE(simple_ops,
.dispatch = (void *)simple_dispatch,
.running = (void *)simple_running,
.stopping = (void *)simple_stopping,
.update_idle = (void *)simple_update_idle,
.enable = (void *)simple_enable,
.init = (void *)simple_init,
.exit = (void *)simple_exit,
.flags = SCX_OPS_ENQ_LAST | SCX_OPS_KEEP_BUILTIN_IDLE,
.name = "simple");

0 comments on commit 7f9b009

Please sign in to comment.