This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0fbeea64d5 mm: Remove mm_spinlock
0fbeea64d5 is described below

commit 0fbeea64d5adac41f4cfec56534e50be36efe221
Author: Xiang Xiao <[email protected]>
AuthorDate: Sat Nov 11 18:31:20 2023 +0800

    mm: Remove mm_spinlock
    
    since it's enough to protect per cpu delay list by disabling interrupt
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 mm/mm_heap/mm.h        | 1 -
 mm/mm_heap/mm_free.c   | 4 ++--
 mm/mm_heap/mm_malloc.c | 4 ++--
 mm/tlsf/mm_tlsf.c      | 9 ++++-----
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h
index f15a7d29ed..28cf0bae0d 100644
--- a/mm/mm_heap/mm.h
+++ b/mm/mm_heap/mm.h
@@ -258,7 +258,6 @@ struct mm_heap_s
    * immdiately.
    */
 
-  spinlock_t mm_spinlock;
   FAR struct mm_delaynode_s *mm_delaylist[CONFIG_SMP_NCPUS];
 
   /* The is a multiple mempool of the heap */
diff --git a/mm/mm_heap/mm_free.c b/mm/mm_heap/mm_free.c
index d2f10fff77..881b025e02 100644
--- a/mm/mm_heap/mm_free.c
+++ b/mm/mm_heap/mm_free.c
@@ -45,12 +45,12 @@ static void add_delaylist(FAR struct mm_heap_s *heap, FAR 
void *mem)
 
   /* Delay the deallocation until a more appropriate time. */
 
-  flags = spin_lock_irqsave(&heap->mm_spinlock);
+  flags = up_irq_save();
 
   tmp->flink = heap->mm_delaylist[up_cpu_index()];
   heap->mm_delaylist[up_cpu_index()] = tmp;
 
-  spin_unlock_irqrestore(&heap->mm_spinlock, flags);
+  up_irq_restore(flags);
 #endif
 }
 
diff --git a/mm/mm_heap/mm_malloc.c b/mm/mm_heap/mm_malloc.c
index 03691c4b1e..46f9648fea 100644
--- a/mm/mm_heap/mm_malloc.c
+++ b/mm/mm_heap/mm_malloc.c
@@ -47,12 +47,12 @@ static void free_delaylist(FAR struct mm_heap_s *heap)
 
   /* Move the delay list to local */
 
-  flags = spin_lock_irqsave(&heap->mm_spinlock);
+  flags = up_irq_save();
 
   tmp = heap->mm_delaylist[up_cpu_index()];
   heap->mm_delaylist[up_cpu_index()] = NULL;
 
-  spin_unlock_irqrestore(&heap->mm_spinlock, flags);
+  up_irq_restore(flags);
 
   /* Test if the delayed is empty */
 
diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c
index 1bf906a4c1..8162976147 100644
--- a/mm/tlsf/mm_tlsf.c
+++ b/mm/tlsf/mm_tlsf.c
@@ -105,7 +105,6 @@ struct mm_heap_s
 
   /* Free delay list, for some situation can't do free immdiately */
 
-  spinlock_t mm_spinlock;
   struct mm_delaynode_s *mm_delaylist[CONFIG_SMP_NCPUS];
 
 #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
@@ -178,12 +177,12 @@ static void add_delaylist(FAR struct mm_heap_s *heap, FAR 
void *mem)
 
   /* Delay the deallocation until a more appropriate time. */
 
-  flags = spin_lock_irqsave(&heap->mm_spinlock);
+  flags = up_irq_save();
 
   tmp->flink = heap->mm_delaylist[up_cpu_index()];
   heap->mm_delaylist[up_cpu_index()] = tmp;
 
-  spin_unlock_irqrestore(&heap->mm_spinlock, flags);
+  up_irq_restore(flags);
 #endif
 }
 
@@ -199,12 +198,12 @@ static void free_delaylist(FAR struct mm_heap_s *heap)
 
   /* Move the delay list to local */
 
-  flags = spin_lock_irqsave(&heap->mm_spinlock);
+  flags = up_irq_save();
 
   tmp = heap->mm_delaylist[up_cpu_index()];
   heap->mm_delaylist[up_cpu_index()] = NULL;
 
-  spin_unlock_irqrestore(&heap->mm_spinlock, flags);
+  up_irq_restore(flags);
 
   /* Test if the delayed is empty */
 

Reply via email to