mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-26 03:20:24 +00:00
scx_rlfifo: user-space idle CPU selection
Select an idle CPU from user-space, instead of always dispatching on the first CPU available. Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
This commit is contained in:
parent
568e292a24
commit
be7ef1009b
@ -54,8 +54,14 @@ impl<'a> Scheduler<'a> {
|
||||
Ok(Some(task)) => {
|
||||
let mut dispatched_task = DispatchedTask::new(&task);
|
||||
|
||||
// Allow to dispatch on the first CPU available.
|
||||
dispatched_task.flags |= RL_CPU_ANY;
|
||||
// Try to pick an idle CPU for the task.
|
||||
let cpu = self.bpf.select_cpu(dispatched_task.pid, dispatched_task.cpu, 0);
|
||||
if cpu >= 0 {
|
||||
dispatched_task.cpu = cpu;
|
||||
} else {
|
||||
// Dispatch task on the first CPU available.
|
||||
dispatched_task.flags |= RL_CPU_ANY;
|
||||
}
|
||||
|
||||
let _ = self.bpf.dispatch_task(&dispatched_task);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user