From 32eccb534af0fd6297b21448c1ed176e337e6f9c 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 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c index a215f04999e49..8779f033110b9 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 */ + /* Check for operations specific to scheduling policy of the currently + * active task. + */ - tmp = wd_timer(ticks, noswitches); + tmp = nxsched_process_scheduler(ticks, elapsed, 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); + /* Process watchdogs */ -#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) + tmp = wd_timer(ticks, noswitches); if (tmp > 0 && (rettime == 0 || tmp < rettime)) { rettime = tmp; } -#endif return rettime; }