Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sched/sched/sched_addreadytorun.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
btcb->flink->task_state = TSTATE_TASK_READYTORUN;
up_update_task(btcb);
ret = true;

#if defined(CONFIG_SCHED_TICKLESS) && CONFIG_RR_INTERVAL > 0
/* Tickless has no periodic tick to keep RR accounting alive, so
* arm the new task's timeslice timer explicitly on switch-in.
*/

if ((btcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_RR)
{
nxsched_reassess_timer();
}
#endif
}
else
{
Expand Down
9 changes: 8 additions & 1 deletion sched/wdog/wdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ static inline_function void wd_timer_start(clock_t tick, bool in_expiration)
#ifdef CONFIG_SCHED_TICKLESS_ALARM
up_alarm_tick_start(next_tick);
#else
up_timer_tick_start(next_tick - clock_systime_ticks());
clock_t delta = next_tick - clock_systime_ticks();

/* Clamp to >= 1 tick: an already-expired 'delta' can go negative
* (overflows unsigned in arch code), and even zero can miss a
* oneshot timer's rising-edge match if the target is already due.
*/

up_timer_tick_start(delta > 0 ? delta : 1);
#endif
}

Expand Down
Loading