diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index 9c4f60b26d8..ba954c4d5f8 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/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? */ - if (!nxsched_islocked_global() && !irq_cpu_locked(me)) - { - /* Search for the highest priority task that can run on this - * CPU. - */ + /* Search for the highest priority task that can run on this + * CPU. + */ - for (rtrtcb = (FAR struct tcb_s *)g_readytorun.head; - rtrtcb != NULL && !CPU_ISSET(cpu, &rtrtcb->affinity); - rtrtcb = rtrtcb->flink); - } + for (rtrtcb = (FAR struct tcb_s *)g_readytorun.head; + rtrtcb != NULL && !CPU_ISSET(cpu, &rtrtcb->affinity); + rtrtcb = rtrtcb->flink); /* Did we find a task in the g_readytorun list? Which task should * we use? We decide strictly by the priority of the two tasks: