Skip to content

jitv2: wake the compile pool only when a worker sleeps - #769

Merged
techomancer merged 1 commit into
mainfrom
jitwakeopt
Nov 17, 2026
Merged

techomancer merged 1 commit into
mainfrom
jitwakeopt

Conversation

@techomancer

Copy link
Copy Markdown
Owner

The producer of compile requests is the CPU thread, and since the pool started parking it took the wake-up mutex and unparked every worker on every push -- including a push dropped on a full queue, which is when it pushes most (every dispatch of an uncompiled page retries).

Workers now count themselves in CompileWake::sleepers before re-checking the lanes and parking; the producer wakes the pool only after an accepted push and only if that count is non-zero. A SeqCst fence on each side keeps the check-then-park race from losing a wakeup. The flush/seal leader and stop() still wake every worker unconditionally.

The producer of compile requests is the CPU thread, and since the pool
started parking it took the wake-up mutex and unparked every worker on
every push -- including a push dropped on a full queue, which is when it
pushes most (every dispatch of an uncompiled page retries).

Workers now count themselves in CompileWake::sleepers before re-checking
the lanes and parking; the producer wakes the pool only after an accepted
push and only if that count is non-zero. A SeqCst fence on each side keeps
the check-then-park race from losing a wakeup. The flush/seal leader and
stop() still wake every worker unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@techomancer
techomancer merged commit a4848ef into main Nov 17, 2026
15 checks passed
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