From 38ddf7d59f9e1a7aa98b17e0ee4793b41ff18ef1 Mon Sep 17 00:00:00 2001 From: zhangyuan29 Date: Thu, 12 Sep 2024 21:29:39 +0800 Subject: [PATCH] sched: process scheduler before wd_timer handler wd_timer handler will change current task, so need process scheduler before wd timer handler, Ensure that the current task is not updated before the RR process Signed-off-by: zhangyuan29 --- sched/sched/sched_timerexpiration.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c index a215f04999..8779f03311 100644 --- a/sched/sched/sched_timerexpiration.c +++ b/sched/sched/sched_timerexpiration.c @@ -347,26 +347,23 @@ static clock_t nxsched_timer_process(clock_t ticks, clock_t elapsed, nxsched_process_cpuload_ticks(elapsed); #endif - /* Process watchdogs */ - - tmp = wd_timer(ticks, noswitches); - if (tmp > 0) - { - rettime = tmp; - } - /* Check for operations specific to scheduling policy of the currently * active task. */ tmp = nxsched_process_scheduler(ticks, elapsed, noswitches); + if (tmp > 0) + { + rettime = tmp; + } -#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) + /* Process watchdogs */ + + tmp = wd_timer(ticks, noswitches); if (tmp > 0 && (rettime == 0 || tmp < rettime)) { rettime = tmp; } -#endif return rettime; }