scx_rustland: assign effective time slice to all tasks

Do not always assign the maximum time slice to interactive tasks, but
use the same value of the dynamic time slice for everyone.

This seems to prevent potential audio cracking when the system is over
commissioned.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi 2024-05-20 11:14:28 +02:00
parent d25675ff44
commit 6901ddb150

View File

@ -543,17 +543,9 @@ impl<'a> Scheduler<'a> {
dispatched_task.set_flag(RL_CPU_ANY);
}
if task.is_interactive && !self.no_preemption {
// Assign the maximum time slice to this task and allow to preempt others.
//
// NOTE: considering that, with preemption enabled, interactive tasks can
// preempt each other (for now) and they are also more likely to release
// the CPU before its assigned time slice expires, always give them the
// maximum static time slice allowed.
dispatched_task.set_slice_ns(self.slice_ns);
dispatched_task.set_flag(RL_PREEMPT_CPU);
} else {
dispatched_task.set_slice_ns(self.effective_slice_ns(nr_scheduled));
}
dispatched_task.set_slice_ns(self.effective_slice_ns(nr_scheduled));
// Send task to the BPF dispatcher.
match self.bpf.dispatch_task(&dispatched_task) {