Skip to content

Commit e0d4da0

Browse files
committedMar 8, 2025·
fix a units error, log more about parallelism determination
1 parent f9d25ca commit e0d4da0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎phd-tests/runner/src/main.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ fn guess_max_reasonable_parallelism(
8888
// than the test runner itself. Overprovisioning CPUs will make everyone
8989
// sad but should not fail tests, at least...
9090
let lim_by_cpus = online_cpus / cpus_per_runner;
91+
info!(
92+
"parallelism by cpu count: {} ({} / {})",
93+
lim_by_cpus, online_cpus, cpus_per_runner
94+
);
9195

9296
let ctl = bhyve_api::VmmCtlFd::open()?;
9397
let reservoir =
@@ -109,7 +113,9 @@ fn guess_max_reasonable_parallelism(
109113
.try_into()
110114
.expect("physical page count is reasonable");
111115

112-
let installed_mb = page_size * total_pages;
116+
const MB: usize = 1024 * 1024;
117+
118+
let installed_mb = page_size * total_pages / MB;
113119
// /!\ Arbitrary choice warning /!\
114120
//
115121
// It would be a little rude to spawn so many VMs that we cause the
@@ -119,7 +125,7 @@ fn guess_max_reasonable_parallelism(
119125
// fraction.
120126
vmm_mem_limit = installed_mb / 4;
121127

122-
eprintln!(
128+
warn!(
123129
"phd-runner sees the VMM reservior is unconfigured, and will use \
124130
up to 25% of system memory ({}MiB) for test VMs. Please consider \
125131
using `cargo run --bin rsrvrctl set <size MiB>` to set aside \
@@ -129,6 +135,10 @@ fn guess_max_reasonable_parallelism(
129135
}
130136

131137
let lim_by_mem = vmm_mem_limit / memory_mib_per_runner;
138+
info!(
139+
"parallelism by memory: {} ({} / {})",
140+
lim_by_mem, vmm_mem_limit, memory_mib_per_runner
141+
);
132142

133143
Ok(std::cmp::min(lim_by_cpus as u16, lim_by_mem as u16))
134144
}

0 commit comments

Comments
 (0)
Please sign in to comment.