Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scheds/rust/scx_layered/src/layer_core_growth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ fn get_cpusets(topo: &Topology) -> Result<BTreeSet<CpuSet>> {
let cpuset_cpus = collect_cpuset_effective()?;
for x in cpuset_cpus {
let mut cores = BTreeSet::new();
for (_, core) in topo.all_cores.iter() {
for core in topo.all_cores.values() {
let mut has_all = true;
for (_, cpu) in core.cpus.iter() {
for cpu in core.cpus.values() {
has_all &= x.contains(&cpu.id);
}
if has_all {
Expand Down
10 changes: 5 additions & 5 deletions scheds/rust/scx_layered/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ impl GpuTaskAffinitizer {
for proc in device
.running_compute_processes()?
.into_iter()
.chain(device.running_graphics_processes()?.into_iter())
.chain(device.running_graphics_processes()?)
{
self.gpu_pids_to_devs.insert(Pid::from_u32(proc.pid), i);
}
Expand Down Expand Up @@ -3185,7 +3185,7 @@ impl<'a> Scheduler<'a> {
let ncpu: u64 = layer.cpus.weight() as u64;
let membw = (membw * 1024_f64.powf(3.0)).round() as u64;
let membw_limit = (membw_limit * 1024_f64.powf(3.0)).round() as u64;
let last_membw_percpu = if ncpu > 0 { membw / ncpu } else { 0 };
let last_membw_percpu = membw.checked_div(ncpu).unwrap_or(0);

// Either there is no memory bandwidth limit set, or the counters
// are not fully initialized yet. Just return the current target.
Expand Down Expand Up @@ -3407,7 +3407,7 @@ impl<'a> Scheduler<'a> {
remaining -= cpus_in_llc;
} else {
let mut extra = 0;
for (_, core) in llc.cores.iter() {
for core in llc.cores.values() {
if remaining == 0 {
break;
}
Expand Down Expand Up @@ -3807,7 +3807,7 @@ impl<'a> Scheduler<'a> {
let prev_nr_cpus: Vec<usize> = self.layers.iter().map(|l| l.nr_cpus).collect();

let mut ascending: Vec<(usize, usize)> = cpu_targets.iter().copied().enumerate().collect();
ascending.sort_by(|a, b| a.1.cmp(&b.1));
ascending.sort_by_key(|a| a.1);

// Snapshot per-layer per-node CPU counts before allocation changes.
let prev_node_cpus: Vec<Vec<usize>> =
Expand Down Expand Up @@ -4545,7 +4545,7 @@ impl<'a> Scheduler<'a> {
Ok(StatsReq::Refresh(tid, mut stats)) => {
// Propagate self's layer cpu ranges into each stat's.
for i in 0..self.nr_layer_cpus_ranges.len() {
for (_, ranges) in cpus_ranges.iter_mut() {
for ranges in cpus_ranges.values_mut() {
ranges[i] = (
ranges[i].0.min(self.nr_layer_cpus_ranges[i].0),
ranges[i].1.max(self.nr_layer_cpus_ranges[i].1),
Expand Down
2 changes: 1 addition & 1 deletion scheds/rust/scx_layered/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl LayerStats {
writeln!(
w,
" cpus={:3} [{:3},{:3}] {}",
self.cur_nr_cpus, self.min_nr_cpus, self.max_nr_cpus, &cpumask,
self.cur_nr_cpus, self.min_nr_cpus, self.max_nr_cpus, cpumask,
)?;
}

Expand Down
Loading