hujun260 commented on code in PR #18135:
URL: https://github.com/apache/nuttx/pull/18135#discussion_r2726401662


##########
sched/sched/sched.h:
##########
@@ -119,6 +119,30 @@
 #  define CRITMONITOR_PANIC(fmt, ...) _alert(fmt, ##__VA_ARGS__)
 #endif
 
+#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0 || \
+    defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION)
+void restore_critical_section(uint16_t count);
+#else
+#  ifdef CONFIG_SMP
+#    define restore_critical_section(count) rspin_restorelock(&g_schedlock, 
count)
+#  else
+#    define restore_critical_section(count)
+#  endif
+#endif
+
+#define nxsched_switch(tcb, rtcb) \
+  do \
+    { \
+      uint16_t count = rspin_lock_count(&g_schedlock); \
+      up_switch_context(tcb, rtcb); \

Review Comment:
   <img width="713" height="372" alt="image" 
src="https://github.com/user-attachments/assets/3a23c86f-14e6-4cf3-b482-fae1a606be45";
 />
   
   In amp restore_critical_section is a null implementation (no-op); the 
related logic will be optimized out, such as rspin_lock_count and 
up_interrupt_context.Performance will not degrade



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

Reply via email to