xiaoxiang781216 commented on code in PR #21393:
URL: https://github.com/apache/nuttx/pull/21393#discussion_r4449777913
##########
sched/init/nx_smpstart.c:
##########
@@ -79,6 +81,15 @@ void nx_idle_trampoline(void)
while (!OSINIT_IDLELOOP());
+ /* A task delivered to this CPU before it could take interrupts may have
+ * lost its inter-processor interrupt. Clear the stale request, which
+ * would block every later delivery here; sched_unlock() runs the task.
+ */
+
+ flags = enter_critical_section();
Review Comment:
why need critical section
##########
sched/sched/sched_setpriority.c:
##########
@@ -80,12 +80,12 @@ static inline void nxsched_running_setpriority(FAR struct
tcb_s *tcb,
* CASE 1. The new priority of the running task becomes less than or
* equal to the next highest priority ready to run task.
* CASE 2. In SMP, the affinity of tcb has changed and no longer includes
- * the current cpu.
+ * the current cpu, also when no other task is ready to run.
*/
#ifdef CONFIG_SMP
- if (nxttcb && (sched_priority <= nxttcb->sched_priority ||
- (tcb->affinity & (1 << tcb->cpu)) == 0))
+ if ((tcb->affinity & (1 << tcb->cpu)) == 0 ||
+ (nxttcb && sched_priority <= nxttcb->sched_priority))
Review Comment:
but the result is same before and after change
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]