Discussion:
[nuttx] [PATCH] kernel/sched: change running order for wd_timer and sched_process_timeslice
eunb.song@samsung.com [nuttx]
2018-04-13 08:51:06 UTC
Permalink
wd_timer()'s callback function can change current running task (g_readytorun.head).
This cause wrong timeslice decrement in sched_process_timeslice.
For example, nxsig_timedwait() adds nxsig_timeout() function as a watchdog function.
And nxsig_timeout function can change current task so there is a possibility that sched_process_timeslice() function decrement wrong task's timeslice.


Signed-off-by: EunBong Song <***@samsung.com>
---
sched/sched/sched_processtimer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)


diff --git a/sched/sched/sched_processtimer.c b/sched/sched/sched_processtimer.c
index 7de2a4b..85186eb 100644
--- a/sched/sched/sched_processtimer.c
+++ b/sched/sched/sched_processtimer.c
@@ -213,13 +213,13 @@ void sched_process_timer(void)
}
#endif


- /* Process watchdogs */
-
- wd_timer();
-
/* Check if the currently executing task has exceeded its
* timeslice.
*/


sched_process_scheduler();
+
+ /* Process watchdogs */
+
+ wd_timer();

}

Loading...