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


##########
sched/sched/sched.h:
##########
@@ -518,23 +514,51 @@ static inline_function bool nxsched_add_prioritized(FAR 
struct tcb_s *tcb,
 }
 
 #  ifdef CONFIG_SMP
+
+/* Try to switch the head of the ready-to-run list to active on "cpu".
+ * "curr_cpu" is "this_cpu()", and passed only for optimization.
+ */
+
+static inline_function bool nxsched_deliver_task(int cpu, int curr_cpu)
+{
+  bool ret = false;
+
+  /* If there is already a schedule interrupt pending, there is
+   * no need to do anything now.
+   */
+
+  if (!g_delivertasks[cpu])

Review Comment:
   This is a good question, and I actually initially had it the way you 
suggested.
   
   However, current version is more optimal; if there is already an smp sched 
interrupt pending, it will take place as soon as we exit the critical section. 
That can't be "canceled", so it is better not to do anything here, but leave it 
to the pending irq. This way we save one extra context switch. I actually also 
can see that this does have an impact to the performance.
   



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