nuttx/sched
ouyangxiangzhen 75bc159896 sched/tickless: Fix SCHED_RR timeslice accounting on preemption
In tickless mode, the scheduler timer is stopped whenever the currently
running task requires no time slicing (CLOCK_MAX).  When a SCHED_RR task
was later switched in, nothing re-armed the timer, so the task could run
indefinitely without round-robin rotation.

Also, when a SCHED_RR task was preempted, its timeslice counter was not
decremented for the time already consumed, effectively giving the task
"bonus" CPU time when resumed.

Solve both by performing RR accounting on context switches:

- nxsched_suspend_roundrobin() charges the elapsed execution time
  against the timeslice of the RR task being switched out
- nxsched_resume_roundrobin() restarts the scheduler timer for the
  remaining timeslice of the RR task being switched in, so the timer
  is always armed while an RR task is running

This also removes the previous workaround in nxsched_process_timer
that triggered the scheduler on every timer tick.

Assisted-by: Zhipu GLM-5.3
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
..
addrenv nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
clock sched/clock: fix stale CLOCK_MONOTONIC on SCHED_TICKLESS 2026-08-21 02:16:04 +08:00
environ sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
event sched/event: Fix uninitialized need_switch flag issue in event_post() 2025-11-04 21:43:59 +08:00
group sched: add setresuid and setresgid 2026-08-12 16:06:03 -03:00
hrtimer sched/hrtimer: Fix reprogram with wrong expiration when reinserting hrtimer 2026-09-07 10:17:46 -03:00
init arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-16 17:07:32 +08:00
instrument gprof: move gprof function from sched to libbuiltin/libgcc 2024-11-13 02:42:31 +08:00
irq !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
misc sched: avoid dumping raw memory at address 0 for tasks without kstack 2026-07-20 20:57:45 -03:00
module libc/dlfcn: Count opens so a library can be shared. 2026-08-04 11:12:49 -03:00
mqueue !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
paging include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched sched/tickless: Fix SCHED_RR timeslice accounting on preemption 2026-09-07 10:17:46 -03:00
semaphore nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr 2026-08-24 13:20:45 +08:00
signal sched/signal: Unblock sigtimedwait through kernel memory. 2026-08-08 14:59:21 -03:00
task !sched/arch/libc: Give fork() and vfork() their real, separate semantics. 2026-08-10 08:57:30 -03:00
timer !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
tls sched: Fix stdio initialization of standard streams when buffering is disabled 2026-08-18 15:19:45 -03:00
wdog !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
wqueue sched/wqueue: use the uninterruptible wait helper 2026-09-04 23:02:48 +08:00
CMakeLists.txt sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
Kconfig sched: add supplementary group IDs (setgroups/getgroups/initgroups) 2026-08-12 16:06:03 -03:00
Makefile tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00