sched: add STACK_USAGE_SAFE_PERCENT for stack overflow check

Change-Id: Ia70e243b36401e28c31fcd7e1b480b79374c27ef
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2021-06-18 16:55:46 +08:00
committed by Xiang Xiao
parent 940c80f7b3
commit 8d2615f78d
2 changed files with 15 additions and 2 deletions
+3 -2
View File
@@ -800,7 +800,7 @@ void nx_start(void)
sinfo("CPU0: Beginning Idle Loop\n");
for (; ; )
{
#if defined(CONFIG_STACK_COLORATION) && defined(CONFIG_DEBUG_MM)
#if defined(CONFIG_STACK_COLORATION) && CONFIG_STACK_USAGE_SAFE_PERCENT > 0
/* Check stack in idle thread */
@@ -812,7 +812,8 @@ void nx_start(void)
flags = enter_critical_section();
tcb = g_pidhash[i].tcb;
if (tcb && up_check_tcbstack_remain(tcb) <= 0)
if (tcb && (up_check_tcbstack(tcb) * 100 / tcb->adj_stack_size
> CONFIG_STACK_USAGE_SAFE_PERCENT))
{
_alert("Stack check failed, pid %d, name %s\n",
tcb->pid, tcb->name);