jlaitine commented on code in PR #16673:
URL: https://github.com/apache/nuttx/pull/16673#discussion_r2281347835


##########
sched/sched/sched_removereadytorun.c:
##########
@@ -174,145 +175,44 @@ void nxsched_remove_running(FAR struct tcb_s *tcb)
    */
 
   nxttcb = tcb->flink;
-  DEBUGASSERT(nxttcb != NULL);
+  DEBUGASSERT(nxttcb != NULL && is_idle_task(nxttcb));
 
   /* The task is running but the CPU that it was running on has been
    * paused.  We can now safely remove its TCB from the running
-   * task list.  In the SMP case this may be either the g_readytorun()
-   * or the g_assignedtasks[cpu] list.
-   */
-
-  dq_rem_head((FAR dq_entry_t *)tcb, tasklist);
-
-  /* Find the highest priority non-running tasks in the g_assignedtasks
-   * list of other CPUs, and also non-idle tasks, place them in the
-   * g_readytorun list. so as to find the task with the highest priority,
-   * globally
-   */
-
-  for (int i = 0; i < CONFIG_SMP_NCPUS; i++)
-    {
-      if (i == cpu)
-        {
-          /* The highest priority task of the current
-           * CPU has been found, which is nxttcb.
-           */
-
-          continue;
-        }
-
-      for (rtrtcb = (FAR struct tcb_s *)g_assignedtasks[i].head;
-                !is_idle_task(rtrtcb); rtrtcb = rtrtcb->flink)
-        {
-          if (rtrtcb->task_state != TSTATE_TASK_RUNNING &&
-              CPU_ISSET(cpu, &rtrtcb->affinity))
-            {
-              /* We have found the task with the highest priority whose
-               * CPU index is i. Since this task must be between the two
-               * tasks, we can use the dq_rem_mid macro to delete it.
-               */
-
-              dq_rem_mid(rtrtcb);

Review Comment:
   Hm, I wonder why remove them? They could be used in some downstream code 
using queues, and they might be useful, even though the current kernel doesn't 
use them.
   
   I'd rather leave them, they are not even related to scheduling as such, just 
part of queue.h
   



-- 
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