Skip to content

Relax Try_Allocate_Request loop#5

Merged
damaki merged 2 commits intomainfrom
topic/relax-try-alloc-loop
Feb 21, 2026
Merged

Relax Try_Allocate_Request loop#5
damaki merged 2 commits intomainfrom
topic/relax-try-alloc-loop

Conversation

@damaki
Copy link
Owner

@damaki damaki commented Feb 21, 2026

Retrieve uses sequentially consistent memory order, so calling it on every loop iteration can introduce extra overhead from memory barriers. It's more efficient to check for null first (using relaxed memory order) and then only call Retrieve if it looks like there's actually a free transaction there to take.

Check_Is_Null is also changed to use __atomic_load_n to make it explicit that the load uses relaxed memory order.

This makes the memory order explicit w.r.t. Exchange and Retrieve.
Retrieve uses sequentially consistent memory order, so calling it
on every loop iteration can introduce extra overhead from memory
barriers. It's more efficient to check for null first (using relaxed
memory order) and then only call Retrieve if it looks like there's
actually a free transaction there to take.
@damaki damaki self-assigned this Feb 21, 2026
@damaki damaki added the enhancement New feature or request label Feb 21, 2026
@damaki damaki merged commit 0a2ddc6 into main Feb 21, 2026
6 checks passed
@damaki damaki deleted the topic/relax-try-alloc-loop branch February 21, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant