mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #335] [MERGED] perf(ublk-daemon): stop devices concurrently on shutdown #357
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#357
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/335
Author: @odysseusy
Created: 10/1/2026
Status: ✅ Merged
Merged: 10/1/2026
Merged by: @yingdi-shan
Base:
main← Head:perf/ublk-daemon-parallel-shutdown📝 Commits (1)
f3f5dcfperf(ublk-daemon): stop devices concurrently on shutdown📊 Changes
1 file changed (+43 additions, -14 deletions)
View changed files
📝
storage/ublk-daemon/src/server.rs(+43 -14)📄 Description
What
Tear down devices concurrently in
UblkDaemonServer::stop_all_devices(), at most 16 at a time. The change uses aJoinSetwith aSemaphore. Each task keeps the existing per-device sequence: quiesce, drop the char-device fd, thendelete_dev.Why
Shutdown stops raw, exclusive, shared and idle pooled devices one after another. Each STOP_DEV/DEL_DEV pair waits for block-layer RCU/SRCU grace periods. Those waits are global and can overlap, but serial teardown makes shutdown time grow linearly: about 45 s for 2000 devices.
Related issue
None. This is a small, self-contained change; happy to open an issue if preferred.
Scope and non-goals
Only the shutdown path changes. The runtime
Deletepath is untouched, because requests on separate connections are already handled concurrently.Design and behavior changes
Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
make fmt/make clippy/make test-unitcover the whole workspace including Go services; I ran the cargo equivalents scoped to the changed crate above. Integration tests need a full Firecracker host. The shutdown path was exercised directly by the A/B runs above.Risks and reviewer notes
The gain is smaller on 7.x because the kernel releases the last device reference under the global
ublk_ctl_mutexand callssrcu_barrier()from there. A kernel fix that moves the put out of the lock is under review upstream: https://lore.kernel.org/r/20261001-bug-ublk-del-dev-put-unlocked-v1-1-18e9bb9be727@gmail.comChecklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.