-
Notifications
You must be signed in to change notification settings - Fork 1.4k
sched/hrtimer: introduce scheduler support with hrtimer #17573
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
base: master
Are you sure you want to change the base?
Conversation
6847a0c to
c073a95
Compare
c073a95 to
f1e9f9a
Compare
f1e9f9a to
e0f1573
Compare
e0f1573 to
424634c
Compare
424634c to
ba4a61f
Compare
ba4a61f to
9bcc6ae
Compare
9bcc6ae to
2c0c6b0
Compare
5b5b4f3 to
5417d32
Compare
cederom
left a comment
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.
Okay, all checks passed, discussions resolved, documentation and tests provided, lets go, is there anything more to add / check / update? :-)
5417d32 to
550f43f
Compare
@xiaoxiang781216 |
4989a06 to
028473f
Compare
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) |
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.
do you need change this line
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.
Done
| * CONFIG_HRTIMER is enabled but not used immediately. | ||
| */ | ||
|
|
||
| static hrtimer_t g_nxsched_hrtimer; |
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.
let's init to func directly and remove g_sched_hrtimer_inited
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.
Done
|
let's squash into one patch @wangchdo |
028473f to
306d77e
Compare
306d77e to
5304044
Compare
OK, Done. |
5304044 to
d541c8e
Compare
This commit add hrtimer support to scheduler tick without altering the existing scheduler behavior. Signed-off-by: Chengdong Wang <[email protected]>
d541c8e to
6bc9758
Compare
| ****************************************************************************/ | ||
|
|
||
| #if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) | ||
| #if defined(CONFIG_HRTIMER)|| \ |
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.
| #if defined(CONFIG_HRTIMER)|| \ | |
| #if defined(CONFIG_HRTIMER) || \ |
| ****************************************************************************/ | ||
|
|
||
| #if defined(CONFIG_SCHED_TICKLESS) | ||
| void nxsched_timer_expiration(void); |
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.
should we merge nxsched_timer_expiration and nxsched_process_timer into one first?
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.
OK, let me consider about this
| #ifdef CONFIG_SCHED_TICKLESS | ||
| nxsched_timer_expiration(); | ||
| #if defined(CONFIG_HRTIMER) || defined(CONFIG_SCHED_TICKLESS) | ||
| nxsched_process_timer(); |
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.
should we update all driver and remove nxsched_timer_expiration
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.
OK, let me consider about this
Summary
This PR introduces high-resolution timer (hrtimer) support as a fully independent and optional module for support of the scheduler, without affecting existing scheduler behavior.
Hrtimer is strictly isolated from the current scheduling logic:
The module does not modify any scheduler data structures or timing paths.
Hrtimer acts solely as an alternative time source. Core scheduler functions (nxsched_process_tick(), nxsched_tick_expiration(), etc.) remain unchanged and are reused as-is.
Additional safeguards:
Integration benefit
This design enables incremental development and review of hrtimer while ensuring that existing NuttX scheduling behavior remains stable even if the hrtimer feature is explicitly enabled.
Development benefit
With this design, developers interested in optimizing the scheduler and those focused on optimizing hrtimer can work independently on their respective improvements.
Impact
Add hrtimer support to nuttx scheduelr, without altering the existing scheduler behavior.
Testing
Test 1 passed (integrated in ostest):
- test implementation:
test log on rv-virt:smp64:
test 2 passed (provided by @Fix-Point )
test implementation
test passed log on rv-virt:smp64
test 3 passed (provided by @Fix-Point )
test implementation
test passed log on rv-virt:smp64