Repository navigation
Conversation
On Linux the runner pins a benchmark from outside with taskset, but on Windows the benchmark pinned itself in harness-common.rb. That loaded Fiddle and kept kernel32 open in the process being measured, only covered harnesses that load harness-common.rb, and left harness-spinel unpinned even though pin? selects Spinel. A child process inherits the affinity mask of its parent when it is created, so the runner now narrows its own mask around Process.spawn and restores it right after. The child starts on the CPU it would be given with taskset. The priority class is not inherited, so the runner sets HIGH_PRIORITY_CLASS and the power throttling opt-out on the child by its PID while Ruby boots, before the harness takes any timings. If pinning fails, the benchmark runs unpinned with a warning as before. RUBY_BENCH_PIN_CPU is gone, and the harness no longer has Windows-specific code. The load_fiddle fix from ruby#549 is kept.
k0kubun
marked this pull request as ready for review
October 13, 2026 23:04
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #549. On Linux, the runner pins a benchmark from outside with `taskset`, but on Windows the benchmark pinned itself in `harness-common.rb`. That loaded Fiddle and kept kernel32 open in the process being measured. It also only covered harnesses that load `harness-common.rb`, so `harness-spinel` was left unpinned even though `pin?` selects Spinel.
A child process inherits its parent's affinity mask when it is created. So the runner now narrows its own mask around `Process.spawn` and restores it right after, and the child starts on the CPU `taskset` would give it. The priority class is not inherited, so the runner sets `HIGH_PRIORITY_CLASS` and the power-throttling opt-out on the child by PID while Ruby boots, before the harness takes any timings. If pinning fails, the benchmark runs unpinned with a warning, as before.
`RUBY_BENCH_PIN_CPU` is gone, and the harness no longer has Windows-specific code. The `load_fiddle` fix from #549 is kept.