diff --git a/scheds/rust/scx_rusty/src/load_balance.rs b/scheds/rust/scx_rusty/src/load_balance.rs index 0d473d3b8..7f412bc01 100644 --- a/scheds/rust/scx_rusty/src/load_balance.rs +++ b/scheds/rust/scx_rusty/src/load_balance.rs @@ -686,7 +686,9 @@ impl<'a, 'b> LoadBalancer<'a, 'b> { let mut pids = vec![]; let (mut ridx, widx) = (active_pids.read_idx, active_pids.write_idx); - ridx = ridx.max(widx - MAX_PIDS); + if widx - ridx > MAX_PIDS { + ridx = widx - MAX_PIDS; + } for idx in ridx..widx { let pid = active_pids.pids[(idx % MAX_PIDS) as usize];