xiaoxiang781216 commented on a change in pull request #4016:
URL: https://github.com/apache/incubator-nuttx/pull/4016#discussion_r662777515



##########
File path: sched/init/nx_start.c
##########
@@ -789,17 +789,35 @@ void nx_start(void)
   sinfo("CPU0: Beginning Idle Loop\n");
   for (; ; )
     {
-      /* Check heap & stack in idle thread */
+#if defined(CONFIG_STACK_COLORATION) && CONFIG_STACK_USAGE_SAFE_PERCENT > 0
 
-      kmm_checkcorruption();
+      /* Check stack in idle thread */
 
-#if defined(CONFIG_STACK_COLORATION) && defined(CONFIG_DEBUG_MM)
-      for (i = 0; i < CONFIG_MAX_TASKS && g_pidhash[i].tcb; i++)
+      for (i = 0; i < CONFIG_MAX_TASKS; i++)
         {
-          assert(up_check_tcbstack_remain(g_pidhash[i].tcb) > 0);
+          FAR struct tcb_s *tcb;
+          irqstate_t flags;
+
+          flags = enter_critical_section();

Review comment:
       @davids5 this code path is only for deveopment, and it's guarded by 
CONFIG_STACK_USAGE_SAFE_PERCENT, which is in the OFF state by default. For the 
separate task solution, it already exist here:
   
https://github.com/apache/incubator-nuttx-apps/tree/master/system/stackmonitor
   Since the separate task solution may report the overflow too later, the 
check in IDLE thread is very useful in the development phase.




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