Skip to content

Commit 1ea5aeb

Browse files
author
Andrea Righi
committed
scx_rustland: always consider slice_ns as maximum time slice
With the introduction of a the dynamic time slice that scales down based on the number of tasks in the system, there is no need anymore to apply a constant scaling factor to time slice to extend the range of the allowed time slices. Therefore, get rid of the static scaling and use slice_ns as the upper limit for the time slice accounted to the tasks. Signed-off-by: Andrea Righi <[email protected]>
1 parent 9b482f4 commit 1ea5aeb

File tree

1 file changed

+4
-8
lines changed
  • scheds/rust/scx_rustland/src

1 file changed

+4
-8
lines changed

scheds/rust/scx_rustland/src/main.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ impl<'a> Scheduler<'a> {
220220
min_vruntime: u64,
221221
slice_ns: u64,
222222
) {
223-
// Allow to scale the maximum time slice by a factor of 10 to increase the range of allowed
224-
// time delta and give a better chance to prioritize tasks with higher weight.
225-
let max_slice_ns = slice_ns * 10;
226-
227223
// Evaluate last time slot used by the task, scaled by its priority (weight).
228224
//
229225
// NOTE: make sure to handle the case where the current sum_exec_runtime is less then the
@@ -243,15 +239,15 @@ impl<'a> Scheduler<'a> {
243239

244240
// Make sure that the updated vruntime is in the range:
245241
//
246-
// (min_vruntime, min_vruntime + max_slice_ns]
242+
// (min_vruntime, min_vruntime + slice_ns]
247243
//
248244
// In this way we ensure that global vruntime is always progressing during each scheduler
249245
// run, preventing excessive starvation of the other tasks sitting in the self.task_pool
250246
// tree.
251247
//
252-
// Moreover, limiting the accounted time slice to max_slice_ns, allows to prevent starving
253-
// the current task for too long in the scheduler task pool.
254-
task_info.vruntime = min_vruntime + slice.clamp(1, max_slice_ns);
248+
// Moreover, limiting the accounted time slice to slice_ns, allows to prevent starving the
249+
// current task for too long in the scheduler task pool.
250+
task_info.vruntime = min_vruntime + slice.clamp(1, slice_ns);
255251

256252
// Update total task cputime.
257253
task_info.sum_exec_runtime = sum_exec_runtime;

0 commit comments

Comments
 (0)