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


##########
sched/sched/sched_setpriority.c:
##########
@@ -177,33 +120,37 @@ static FAR struct tcb_s *nxsched_nexttcb(FAR struct tcb_s 
*tcb)
 static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb,
                                                int sched_priority)
 {
-  FAR struct tcb_s *nxttcb;
-
   /* Get the TCB of the next highest priority, ready to run task */
 
+  FAR struct tcb_s *nxttcb;

Review Comment:
   why change the order



##########
sched/sched/sched_setpriority.c:
##########
@@ -223,29 +230,30 @@ static inline void nxsched_running_setpriority(FAR struct 
tcb_s *tcb,
           /* A context switch will occur. */
 
 #ifdef CONFIG_SMP
-          if (tcb->cpu != this_cpu() &&
+          int cpu = this_cpu();
+          if (tcb->cpu != cpu &&
               tcb->task_state == TSTATE_TASK_RUNNING)
             {
-              struct reprioritize_arg_s arg;
+              struct reprioritize_arg_s *arg = &g_reprioritize_arg[cpu];

Review Comment:
   but even with per cpu argument, caller may schedule the new priority change 
request to the same cpu before the previous one finish the action.



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