scx_rlfifo: dispatch all tasks on the first CPU available

With commit 786ec0c0 ("scx_rlfifo: schedule all tasks in user-space")
all the scheduling decisions are now happening in user-space. This also
bypasses the built-in idle selection logic, delegating the CPU selection
for each task to the user-space scheduler.

The easiest way to distribute tasks across the available CPUs is to
simply allow to dispatch them on the first CPU available.

In this way the scheduler becomes usable in practical scenarios and at
the same time it also maintains its simplicity.

This allows to spread all tasks across all the available CPUs

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi 2024-06-15 16:13:53 +02:00
parent 786ec0c04a
commit cb20a6f136

View File

@ -55,7 +55,11 @@ impl<'a> Scheduler<'a> {
// task.cpu < 0 is used to to notify an exiting task, in this
// case we can simply ignore the task.
if task.cpu >= 0 {
let dispatched_task = DispatchedTask::new(&task);
let mut dispatched_task = DispatchedTask::new(&task);
// Allow to dispatch on the first CPU available.
dispatched_task.set_flag(RL_CPU_ANY);
let _ = self.bpf.dispatch_task(&dispatched_task);
// Give the task a chance to run and prevent overflowing the dispatch queue.