GUIDINGLI commented on code in PR #11226:
URL: https://github.com/apache/nuttx/pull/11226#discussion_r1400051074


##########
sched/sched/sched_removereadytorun.c:
##########
@@ -194,22 +194,15 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, 
bool merge)
        * next tcb in the assigned task list (nxttcb) or a TCB in the
        * g_readytorun list.  We can only select a task from that list if
        * the affinity mask includes the current CPU.
-       *
-       * If pre-emption is locked or another CPU is in a critical section,
-       * then use the 'nxttcb' which will probably be the IDLE thread.
-       * REVISIT: What if it is not the IDLE thread?

Review Comment:
   > With REGARD to the REVISIT: I don't believe that this is a problem in the 
current design. A lot has changed and we need @masayuki2009 to verify this.
   > 
   > In the past, there could be multiple TCBs in the assigned task list. But 
it looks like assigned (but not running) TCBs are now held in the ready-to-run 
list.
   
   **correct!  feed1 thread is in ready-to-run list. And its has been 
"assigned" to the CPU via one of the setaffinity() functions**
   
   > 
   > If that is correct, then the assigned task list can be in only one of two 
states:
   > 
   > 1. It contains only the running IDLE thread's TCB only, or
   > 2. It contains the TCB of the running task AND the ready-to-run IDLE 
thread.
   > 
   > So removing the TCB of the running task should always leave only the IDLE 
task, assuming state 2!
   >
   **Yes, assigned task list has two TCB: hello_main & IDLE task. And 
hello_main should be removed, case the user call exit.**
   > It seems like there should be a check to assure that the IDLE thread's TCB 
is never removed by nxsched_remove_readytorun(). The check must be there, but I 
don't see it.
   
   **At remove_readytorun() function, it should BOTH pick the ready-to-run list 
and assigned task list.
   So at this time, should we ignore the sched_lock state ?**



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to