turbo-tasks: add info_span for blocking waits during task restore#92878
Merged
Conversation
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
Merging this PR will improve performance by 3.34%
Performance Changes
Comparing Footnotes
|
lukesandberg
approved these changes
Apr 16, 2026
This was referenced Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds a
tracing::info_span!("blocking")aroundlistener.wait()calls inExecuteContextImpl::task()when a task is still being restored from backing storage.Why?
When a task is locked for restoration by another thread, the current thread spins in a loop and calls
listener.wait()until notified. CPU time accounting treats this waiting time as active CPU usage, which skews profiling results.By wrapping the wait in a
"blocking"span, the tracing infrastructure can correctly exclude this idle blocking time from CPU time — ensuring CPU metrics reflect actual computation rather than time spent waiting for another thread to finish restoring a task.How?
Import
tracing::info_spanand enter a"blocking"span immediately beforelistener.wait()in the restore-wait loop inturbopack/crates/turbo-tasks-backend/src/backend/operation/mod.rs. The span is dropped when the wait returns (or when the loop continues to re-check the condition).