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


##########
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:
   ok



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