From fe3ce64a9b2c7686db85cba59db4655d410b2aaa Mon Sep 17 00:00:00 2001 From: David Vernet Date: Wed, 26 Jun 2024 17:35:22 -0400 Subject: [PATCH] Revert "scx_rusty: Refactor ridx assignment in populate_tasks_by_load" --- scheds/rust/scx_rusty/src/load_balance.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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];