-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how to free the last released memory by QSBR threads #622
Conversation
WalkthroughThe pull request modifies the thread state management in the Changes
Sequence DiagramsequenceDiagram
participant Thread as "Thread"
participant QSBR as "QSBR Mechanism"
Thread->>QSBR: qsbr_resume()
Thread->>QSBR: quiescent()
Thread->>QSBR: quiescent()
Note over Thread,QSBR: Ensure cleanup of orphaned requests
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🔇 Additional comments (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
examples/example_olc_art.cpp
(1 hunks)qsbr.hpp
(4 hunks)
🔇 Additional comments (3)
qsbr.hpp (3)
758-764
: Improved documentation of thread quitting behavior.The added comments in
assert_idle
effectively explain why orphaned requests might not be executed until the next epoch change and why users should pass through quiescent state multiple times at the end.
926-929
: Added clarification for double epoch advance.The comment explains a specific edge case where a thread that's quitting but hasn't seen the current epoch can cause a double epoch advance.
622-622
: Changed thread initialization state from paused to active.The change to initialize
paused
asfalse
makes the default thread state more intuitive, as threads typically start in an active state.Let's verify that this change doesn't break any assumptions in the codebase:
✅ Verification successful
Initial active thread state is safe and more intuitive.
The codebase explicitly manages thread states through
qsbr_pause()
andqsbr_resume()
calls, with no reliance on the initial paused state. Tests and examples demonstrate proper thread state management through explicit transitions.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if any code relies on threads starting in a paused state # Look for patterns where threads are created and not explicitly paused/resumed # Search for thread creation without explicit pause/resume rg -A 5 'qsbr_thread|std::thread'Length of output: 25213
669aebf
to
3876128
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #622 +/- ##
==========================================
- Coverage 99.37% 99.35% -0.03%
==========================================
Files 31 31
Lines 4325 4325
==========================================
- Hits 4298 4297 -1
- Misses 27 28 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit
New Features
Documentation
Bug Fixes