From 08bae1362453874d457f03038cfa759d60ad72f7 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 21 Oct 2023 17:18:57 +0800 Subject: [PATCH] mm/tlfs: Replace the critical section with spin lock Base on discusion: https://github.com/apache/nuttx/issues/10981 Signed-off-by: Xiang Xiao --- mm/tlsf/mm_tlsf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c index 1333d4bcc83..5d221a8e3d1 100644 --- a/mm/tlsf/mm_tlsf.c +++ b/mm/tlsf/mm_tlsf.c @@ -173,12 +173,12 @@ static void add_delaylist(FAR struct mm_heap_s *heap, FAR void *mem) /* Delay the deallocation until a more appropriate time. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); tmp->flink = heap->mm_delaylist[up_cpu_index()]; heap->mm_delaylist[up_cpu_index()] = tmp; - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); #endif } @@ -194,12 +194,12 @@ static void free_delaylist(FAR struct mm_heap_s *heap) /* Move the delay list to local */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); tmp = heap->mm_delaylist[up_cpu_index()]; heap->mm_delaylist[up_cpu_index()] = NULL; - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); /* Test if the delayed is empty */