Skip to content

[pull] master from ruby:master - #1338

Merged
pull[bot] merged 5 commits into
turkdevops:masterfrom
ruby:master
Aug 23, 2026
Merged

[pull] master from ruby:master#1338
pull[bot] merged 5 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull

@pull pull Bot commented Aug 23, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

ko1 and others added 5 commits August 23, 2026 10:01
native_thread_dedicated_inc/dec run on every blocking region boundary and
took ractor.sched.lock each way just to move two counters.  Make snt_cnt a
seq-cst atomic: leaving the pool is one FETCH_SUB, and rejoining is a CAS
loop that enforces the max_cpu cap.  The lock is taken only when the last
snt goes dedicated, to check grq_cnt and wake the timer thread.

The lost-wakeup gate stays sound as a store-buffer pair: ractor_sched_enq
raises grq_cnt and then reads snt_cnt; dedicated_inc lowers snt_cnt and
then reads grq_cnt under the lock, so at least one side sees the other.

Both increment paths (rejoin and pool widening) check the cap and then
CAS, so max_cpu still holds without the lock.

dnt_cnt only ever fed one RUBY_DEBUG_LOG line, so define and update it
only under USE_RUBY_DEBUG_LOG, without atomicity; nothing may read it
for decisions.

R ractors x 1 thread each doing pipe write/read round-trips on a 16-HT
machine (Ryzen 9 5900HX), round-trips/sec, median of repeated runs:

      R    master   patched
      1      422k      430k    +2%
      2      718k      752k    +5%
      4      933k    1,036k   +11%
      8      905k    1,111k   +23%
     16      735k    1,016k   +38%
     32      671k      955k   +42%
     64      690k      952k   +38%
    128      685k      946k   +38%

master peaks at 4 ractors and degrades under lock contention; patched
peaks at 8 and holds up to 128.  Single-ractor shapes are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
and allow to declare `dnt_cnt` only for logging.
If we embed the iseq_body, then it won't be a stable address, so we
shouldn't depend on the pointer address as a stable hash key. We can instead
use the location where it's defined as the hash key.
@pull pull Bot locked and limited conversation to collaborators Aug 23, 2026
@pull pull Bot added the ⤵️ pull label Aug 23, 2026
@pull
pull Bot merged commit e61f5c3 into turkdevops:master Aug 23, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants