Skip to content

Conversation

@wangchdo
Copy link
Contributor

@wangchdo wangchdo commented Jan 19, 2026

Summary

This PR includes two commits:

commit 1:
Consolidate nxsched_process_timer into sched_timer.c, and introduce
nxsched_process_tick() to improve readability and maintainability of
the scheduler timer processing logic.

commit 2:
Add hrtimer support to drive the scheduler.

Impact

Improve scheduler timer processing logic and enable hrtimer support for scheduler.

Testing

ostest passed on rv-virt:smp64 when hrtimer is enabled

NuttShell (NSH)
nsh> 
nsh> 
nsh> uname -a
NuttX 0.0.0 a8c1583552-dirty Jan 19 2026 13:12:31 risc-v rv-virt
nsh> ostest

(...)

user_main: hrtimer test

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena     1fc0c20  1fc0c20
ordblks         6        6
mxordblk  1fab270  1fab270
uordblks    10898    12080
fordblks  1fb0388  1faeba0

Final memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena     1fc0c20  1fc0c20
ordblks         1        6
mxordblk  1fb5b30  1fab270
uordblks     b0f0    12080
fordblks  1fb5b30  1faeba0
user_main: Exiting
ostest_main: Exiting with status 0
nsh> 

ostest passed on a2g-tc397-5v-tft:nsh when hrtimer is enabled

NuttShell (NSH)
nsh>
nsh>
nsh>
nsh> uname -a
NuttX 0.0.0 a8c1583552-dirty Jan 19 2026 13:16:08 tricore a2g-tc397-5v-tft
nsh>
nsh> ostest

(...)

user_main: hrtimer test

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       28dfc    28dfc
ordblks         6        6
mxordblk    1f890    1f890
uordblks     5574     5574
fordblks    23888    23888

Final memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       28dfc    28dfc
ordblks         1        6
mxordblk    24208    1f890
uordblks     4bf4     5574
fordblks    24208    23888
user_main: Exiting
ostest_main: Exiting with status 0
nsh>

Consolidate nxsched_process_timer into sched_timer.c, and introduce
nxsched_process_tick() to improve readability and maintainability of
the scheduler timer processing logic.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
@wangchdo wangchdo force-pushed the sched_timer branch 5 times, most recently from 50efba5 to b254645 Compare January 19, 2026 06:26
Add hrtimer support to drive the scheduler.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
@wangchdo wangchdo changed the title sched/sched: add sched_timer.c to improve tick processing and support hrtimer sched/sched: add sched_timer.c to improve tick processing and enable hrtimer support for scheduler Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Area: OS Components OS Components issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants