TTAS slow path with adaptive backoff#8
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR implements a TTAS (test-and-test-and-set) lock acquisition strategy with adaptive backoff to improve performance under contention. The fast path uses a single FAA (Fetch-And-Add) operation, while the slow path spins on read-only loads to minimize cache-line invalidations before attempting acquisition. Additionally, the PR fixes a data race on yieldDuration by protecting it with a Lock, and updates the Go version from 1.25 to 1.26.
Changes:
- Rewrites Lock() into fast path (inline FAA) and lockSlow() (TTAS with adaptive backoff)
- Protects yieldDuration with Lock to enable safe concurrent access from Yield() and SetYieldDuration()
- Updates Go version from 1.25 to 1.26 in go.mod and CI workflows
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lock.go | Implements TTAS acquisition with fast/slow path split and iteration-based adaptive backoff; adds comprehensive documentation on FAA/MESI cache coherence |
| yield.go | Adds Lock-based protection for yieldDuration to fix data race; documents concurrent safety |
| pause_test.go | Updates comment to reflect new defaultPauseCycles value of 30 |
| go.mod | Bumps Go version from 1.25 to 1.26 |
| .github/workflows/ci.yml | Updates all CI jobs to use Go 1.26.x |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Changes: