Conversation
6a97702 to
9c07ba6
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds real-time scheduling support by locking process memory and setting thread priorities to improve determinism in critical loops.
- Calls
lock_memoryearly inmainto prevent page faults - Invokes
set_realtime_priorityin both the main loop and EtherCAT thread - Introduces a new
control_core::realtimemodule withlock_memoryandset_realtime_priorityand updates dependencies
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/src/main.rs | Added lock_memory() call with error/info logging |
| server/src/loop.rs | Added set_realtime_priority() in the main loop thread |
| server/src/ethercat/setup.rs | Added set_realtime_priority() in the EtherCAT TxRx thread |
| control-core/src/realtime.rs | New module implementing memory locking and scheduling APIs |
| control-core/src/lib.rs | Exposed the new realtime module |
| control-core/Cargo.toml | Added libc dependency for Unix targets |
Comments suppressed due to low confidence (3)
control-core/src/realtime.rs:10
- The doc comment states priority 80, but the code sets
param.sched_priority = 95. Update the documentation to match the actual value or adjust the code to use 80 for consistency.
/// 2. Setting the real-time priority to 80 (on a scale of 1-99, where higher values indicate
control-core/src/realtime.rs:1
- [nitpick] The new real-time functions lack unit tests. Consider adding tests (possibly via integration/mocking) for
lock_memory()andset_realtime_priority()to validate behavior and error handling.
#[cfg(unix)]
control-core/Cargo.toml:24
- Non-Unix branches use
log::error!, butlogisn’t listed under[dependencies]. Addlog = "0.4"or switch totracing::error!for consistency and to ensure compilation.
[target.'cfg(unix)'.dependencies]
56f6a1e to
dd52042
Compare
# This is the 1st commit message: move lock emmory after tracing # This is the commit message #2: Only lock future memory
Only lock future memory disable memory locking
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.
fix #7