sched/sched/remove_readytorun.c: Fix CPU affinity issues in SMP
the logical may choose the head of g_readytorun(the greatest priority) task as the next while ignoring the cpu affinity of it. Signed-off-by: chenhonglin <chenhonglin@xiaomi.com>
This commit is contained in:
parent
cb38060db2
commit
dfc08a0b66
@ -209,20 +209,16 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb)
|
|||||||
|
|
||||||
if (rtrtcb != NULL && rtrtcb->sched_priority >= nxttcb->sched_priority)
|
if (rtrtcb != NULL && rtrtcb->sched_priority >= nxttcb->sched_priority)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *tmptcb;
|
/* The TCB rtrtcb has the higher priority and it can be run on
|
||||||
|
* target CPU. Remove that task (rtrtcb) from the g_readytorun
|
||||||
/* The TCB at the head of the ready to run list has the higher
|
|
||||||
* priority. Remove that task from the head of the g_readytorun
|
|
||||||
* list and add to the head of the g_assignedtasks[cpu] list.
|
* list and add to the head of the g_assignedtasks[cpu] list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tmptcb = (FAR struct tcb_s *)
|
dq_rem((FAR dq_entry_t *)rtrtcb, (FAR dq_queue_t *)&g_readytorun);
|
||||||
dq_remfirst((FAR dq_queue_t *)&g_readytorun);
|
dq_addfirst((FAR dq_entry_t *)rtrtcb, tasklist);
|
||||||
|
|
||||||
dq_addfirst((FAR dq_entry_t *)tmptcb, tasklist);
|
rtrtcb->cpu = cpu;
|
||||||
|
nxttcb = rtrtcb;
|
||||||
tmptcb->cpu = cpu;
|
|
||||||
nxttcb = tmptcb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Will pre-emption be disabled after the switch? If the lockcount is
|
/* Will pre-emption be disabled after the switch? If the lockcount is
|
||||||
|
Loading…
Reference in New Issue
Block a user