Fix thread priorities (kind of).

This commit is contained in:
Joshua Yanovski 2023-04-06 14:52:55 -07:00
parent 0c99438993
commit 7357aaf1ab

View File

@ -338,7 +338,8 @@ impl State {
};
let total = total.max(common::consts::MIN_RECOMMENDED_RAYON_THREADS);
let cores = core_affinity::get_core_ids().unwrap_or(vec![]).into_iter().skip(start).step_by(step).take(total).collect::<Vec<_>>();
let floating = total.saturating_sub(cores.len());
let num_cores = cores.len();
let floating = total.saturating_sub(num_cores);
// TODO: NUMA utils
let slow_pool = slowjob::ThreadPoolBuilder::new()
.thread_name(move |i| format!("slowjob-{}-{}", thread_name_infix, i))
@ -352,7 +353,7 @@ impl State {
}
// pinned slowjob threads run with low priority
let index = thread.index();
if index < floating {
if index < num_cores {
b = b.priority(ThreadPriority::Min);
}
b.spawn_careless(|| thread.run())?;