Change ordering of round-robin time slice check (sched_process_scheduler()) and processing of wdog timers (wd_timer()). wd_timer()'s callback function can change current running task and, hence, must be done after the time slice check.

The time slice check will decrement the currently running task's time slice allotment.  If such a context switch occurs, then the newly started task will lost one could of that allotment before it even has a chance to run.
This commit is contained in:
EunBong Song 2018-04-13 07:38:15 -06:00 committed by Gregory Nutt
parent cf8c25df64
commit 5951bcd837
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/sched/sched_processtimer.c
*
* Copyright (C) 2007, 2009, 2014-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2014-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -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();
}