From 46ec836e56c560bdfed6bdddaf26e6899d0ecf80 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Fri, 7 Mar 2025 17:07:49 +0800 Subject: [PATCH] sched: binfmt remove csection use small lock to replace big lock Signed-off-by: hujun5 --- binfmt/binfmt_execsymtab.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/binfmt/binfmt_execsymtab.c b/binfmt/binfmt_execsymtab.c index ff83b16eb3c..9e1fb349e8b 100644 --- a/binfmt/binfmt_execsymtab.c +++ b/binfmt/binfmt_execsymtab.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef CONFIG_LIBC_EXECFUNCS @@ -71,6 +72,7 @@ extern int CONFIG_EXECFUNCS_NSYMBOLS_VAR; static FAR const struct symtab_s *g_exec_symtab; static int g_exec_nsymbols; +static spinlock_t g_exec_lock = SP_UNLOCKED; /**************************************************************************** * Public Functions @@ -102,7 +104,7 @@ void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols) * size are returned as a single atomic operation. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_exec_lock); #ifdef CONFIG_EXECFUNCS_HAVE_SYMTAB /* If a bring-up symbol table has been provided and if the exec symbol @@ -121,7 +123,7 @@ void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols) *symtab = g_exec_symtab; *nsymbols = g_exec_nsymbols; - leave_critical_section(flags); + spin_unlock_irqrestore(&g_exec_lock, flags); } /**************************************************************************** @@ -149,10 +151,10 @@ void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols) * size are set as a single atomic operation. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_exec_lock); g_exec_symtab = symtab; g_exec_nsymbols = nsymbols; - leave_critical_section(flags); + spin_unlock_irqrestore(&g_exec_lock, flags); } #endif /* CONFIG_LIBC_EXECFUNCS */