Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vmm: use available_parallelism for prefault threads - #8538

Merged
rbradford merged 1 commit into
cloud-hypervisor:mainfrom
pkbhowmick:chore/use-available-parallelism
Jul 9, 2026
Merged

rbradford merged 1 commit into
cloud-hypervisor:mainfrom
pkbhowmick:chore/use-available-parallelism

Conversation

@pkbhowmick

Copy link
Copy Markdown
Contributor

fix #8495

@pkbhowmick
pkbhowmick requested a review from a team as a code owner July 7, 2026 08:07

@rbradford rbradford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I know bytes are expensive these days but I think we can afford to have a commit message body :-)

Also include the issue number in the commit message body (and if you had used gh to create the PR it would have filled the PR description from the body).

Comment thread vmm/src/memory_manager.rs
Comment thread vmm/src/memory_manager.rs
@pkbhowmick
pkbhowmick force-pushed the chore/use-available-parallelism branch 2 times, most recently from 62d75cb to 28f4e44 Compare July 7, 2026 08:42
Comment thread vmm/src/memory_manager.rs Outdated
@pkbhowmick
pkbhowmick force-pushed the chore/use-available-parallelism branch 3 times, most recently from f9a80be to 0102c03 Compare July 7, 2026 09:07
Comment thread vmm/src/memory_manager.rs Outdated
@pkbhowmick
pkbhowmick force-pushed the chore/use-available-parallelism branch 3 times, most recently from 10414f5 to cee8b0e Compare July 7, 2026 09:58
Comment thread vmm/src/memory_manager.rs
@@ -2223,14 +2222,11 @@ impl MemoryManager {
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the CONTRIBUTING.md file and look at the existing commits and fix your commit message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message still isn't right. It wasn't using a fixed default before - it was accessing the number of vCPUs via sysconf (which is what the new API does under the hood).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed this ^

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh sorry. updated with

Use std::thread::available_parallelism() when sizing the prefault
worker threads so the number of threads scales with the host CPU
count instead of relying on unsafe sysconf.

please feel free to suggest if you have something else in mind

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You typoed I think. It should be "Fixes: #8495"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :D

@rbradford rbradford Jul 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repository style is "Fixes: #8495"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. didn't realize it is that strict

@pkbhowmick
pkbhowmick force-pushed the chore/use-available-parallelism branch 2 times, most recently from 171343b to 2b27bba Compare July 7, 2026 14:32
@pkbhowmick
pkbhowmick requested a review from rbradford July 7, 2026 14:34
@pkbhowmick
pkbhowmick force-pushed the chore/use-available-parallelism branch 4 times, most recently from 8338dd0 to cf88210 Compare July 7, 2026 15:29
@rbradford
rbradford enabled auto-merge July 7, 2026 15:48
@rbradford

Copy link
Copy Markdown
Member

Thanks!

@rbradford
rbradford disabled auto-merge July 8, 2026 09:11
@rbradford

Copy link
Copy Markdown
Member

@pkbhowmick Fails stable clippy.

Use std::thread::available_parallelism() when sizing the prefault
worker threads so the number of threads scales with the host CPU
count instead of relying on unsafe sysconf.

Fixes: cloud-hypervisor#8495

Signed-off-by: Pulak Kanti Bhowmick <[email protected]>
@rbradford
rbradford force-pushed the chore/use-available-parallelism branch from cf88210 to 373061e Compare July 9, 2026 10:59

@rbradford rbradford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave up waiting for the ~30s fix and just updated the PR. Thanks.

@rbradford
rbradford enabled auto-merge July 9, 2026 11:01
@rbradford
rbradford added this pull request to the merge queue Jul 9, 2026
Merged via the queue into cloud-hypervisor:main with commit 03e2297 Jul 9, 2026
41 checks passed
@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Done in Cloud Hypervisor Roadmap Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Replace get_prefault_num_threads() with available_parallelism()

3 participants