scx_rustland: enable user-space scheduler to preempt other tasks

Use SCX_ENQ_PREEMPT to dispatch the user-space scheduler. This can help
to mitigate starvation in presence of many cpu hogs (way more than the
amount of available CPUs) running in the system, by giving the scheduler
more chances to drain the amount of tasks that may be starving in a
waiting state.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi 2024-01-03 21:04:19 +01:00
parent 020ae33fe2
commit 8820af8d36

View File

@ -415,7 +415,7 @@ static void dispatch_user_scheduler(void)
* Always try to dispatch the user-space scheduler on the current CPU,
* if possible.
*/
dispatch_on_cpu(p, bpf_get_smp_processor_id(), 0);
dispatch_on_cpu(p, bpf_get_smp_processor_id(), SCX_ENQ_PREEMPT);
__sync_fetch_and_add(&nr_kernel_dispatches, 1);
bpf_task_release(p);
}