mirror of
https://github.com/sched-ext/scx.git
synced 2024-11-25 04:00:24 +00:00
scx_rusty: Refactor ridx assignment in populate_tasks_by_load
Origin assignment of the variable ridx is equivalent to comparing between "ridx" and "wids - MAX_PIDS". Using u64 max library helper function to perform the comparison and provide better readability. Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
This commit is contained in:
parent
5038f54701
commit
eab234a74f
@ -686,9 +686,7 @@ impl<'a, 'b> LoadBalancer<'a, 'b> {
|
||||
let mut pids = vec![];
|
||||
|
||||
let (mut ridx, widx) = (active_pids.read_idx, active_pids.write_idx);
|
||||
if widx - ridx > MAX_PIDS {
|
||||
ridx = widx - MAX_PIDS;
|
||||
}
|
||||
ridx = ridx.max(widx - MAX_PIDS);
|
||||
|
||||
for idx in ridx..widx {
|
||||
let pid = active_pids.pids[(idx % MAX_PIDS) as usize];
|
||||
|
Loading…
Reference in New Issue
Block a user