Skip to content

Count I/O threads in /proc instead of asking backends - #161

Closed
tmakatos wants to merge 1 commit into
mainfrom
optional-thread-count
Closed

tmakatos wants to merge 1 commit into
mainfrom
optional-thread-count

Conversation

@tmakatos

Copy link
Copy Markdown
Collaborator

The controller already counts the backend tasks that match the thread name filter when it samples their CPU usage in /proc. Make that the only source of the thread count, sampling /proc on every refresh, even when the backend reports per-thread utilisation.

Backends may still report the thread count, as a future change can use it to avoid rescanning /proc on every refresh, so make ThreadPoolSnapshot::thread_count optional. The controller ignores it for now.

The QEMU backend now selects its IOThreads by task name, "IO ", which QEMU sets when started with debug-threads=on, as libvirt does.

When no task matches, keep the previous thread count and postpone classifying the initial pool until a later poll observes it. Don't apply engine decisions to a VM whose threads haven't been counted yet, as they would be relative to a thread count of zero.

AI-generated: everything

The controller already counts the backend tasks that match the thread
name filter when it samples their CPU usage in /proc. Make that the only
source of the thread count, sampling /proc on every refresh, even when
the backend reports per-thread utilisation.

Backends may still report the thread count, as a future change can use
it to avoid rescanning /proc on every refresh, so make
ThreadPoolSnapshot::thread_count optional. The controller ignores it
for now.

The QEMU backend now selects its IOThreads by task name, "IO <id>",
which QEMU sets when started with debug-threads=on, as libvirt does.

When no task matches, keep the previous thread count and postpone
classifying the initial pool until a later poll observes it. Don't apply
engine decisions to a VM whose threads haven't been counted yet, as they
would be relative to a thread count of zero.

AI-generated: everything
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
@tmakatos tmakatos closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant