You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/30 10:02:05 UTC

[incubator-nuttx] branch master updated: sched: fix the bug of task's tmeslice

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 76b2f71  sched: fix the bug of task's tmeslice
76b2f71 is described below

commit 76b2f7199d0c6d4ba99121c5563be4d50e2ed631
Author: walker.zeng <wa...@transtekcorp.com>
AuthorDate: Mon Dec 13 17:25:38 2021 +0800

    sched: fix the bug of task's tmeslice
    
    The BUG is as follow:
     1. Suppose there are two ready tasks t1 and t2 have the same priority, and t1 is the running.
     2. A new, higher priority task t0 (such as hpwork) is ready, then switch to t0.
     3. After t0 is suspended, then switch to t1 and reset the t1's timeslice.
     4. goto 2
    The t2 will have no chance to run.
    
    Signed-off-by: Zeng Zhaoxiu <zh...@gmail.com>
---
 sched/sched/sched_resumescheduler.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sched/sched/sched_resumescheduler.c b/sched/sched/sched_resumescheduler.c
index b4ec53c..b9bec06 100644
--- a/sched/sched/sched_resumescheduler.c
+++ b/sched/sched/sched_resumescheduler.c
@@ -57,21 +57,7 @@
 
 void nxsched_resume_scheduler(FAR struct tcb_s *tcb)
 {
-#if CONFIG_RR_INTERVAL > 0
 #ifdef CONFIG_SCHED_SPORADIC
-  if ((tcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_RR)
-#endif
-    {
-      /* Reset the task's timeslice. */
-
-      tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
-    }
-#endif
-
-#ifdef CONFIG_SCHED_SPORADIC
-#if CONFIG_RR_INTERVAL > 0
-  else
-#endif
   if ((tcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
     {
       /* Reset the replenishment cycle if it is appropriate to do so */