You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/04/01 03:43:34 UTC

[incubator-nuttx] branch master updated: mm: mm_heap: Remove critical section in mm_sem.c

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f99f590  mm: mm_heap: Remove critical section in mm_sem.c
f99f590 is described below

commit f99f590751178915a918581b441bbffb2595b267
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed Mar 24 08:01:16 2021 +0900

    mm: mm_heap: Remove critical section in mm_sem.c
    
    Summary:
    - This commit removes critical section in mm_sem.c which was
      added to stabilize the NuttX SMP kernel in Mar 2018.
    
    Impact:
    - SMP only
    
    Testing:
    - Tested with ostest with the following configs
     - maix-bit:smp (QEMU), esp32-devkitc:smp (QEMU)
     - sabre-6quad:smp (QEMU), spresense:smp, sim:smp
    - Tested with nxplayer with the following configs
     - spresense:wifi_smp, spresense:rndis_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 mm/mm_heap/mm_sem.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c
index bdb233a..bb184d4 100644
--- a/mm/mm_heap/mm_sem.c
+++ b/mm/mm_heap/mm_sem.c
@@ -32,10 +32,6 @@
 #include <nuttx/semaphore.h>
 #include <nuttx/mm/mm.h>
 
-#ifdef CONFIG_SMP
-#  include <nuttx/irq.h>
-#endif
-
 #include "mm_heap/mm.h"
 
 /****************************************************************************
@@ -105,9 +101,6 @@ void mm_seminitialize(FAR struct mm_heap_s *heap)
 int mm_trysemaphore(FAR struct mm_heap_s *heap)
 {
   FAR struct mm_heap_impl_s *heap_impl;
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
   pid_t my_pid = getpid();
   int ret;
 
@@ -181,9 +174,6 @@ int mm_trysemaphore(FAR struct mm_heap_s *heap)
     }
 
 errout:
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
   return ret;
 }
 
@@ -199,9 +189,6 @@ errout:
 void mm_takesemaphore(FAR struct mm_heap_s *heap)
 {
   FAR struct mm_heap_impl_s *heap_impl;
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
   pid_t my_pid = getpid();
 
   DEBUGASSERT(MM_IS_VALID(heap));
@@ -248,9 +235,6 @@ void mm_takesemaphore(FAR struct mm_heap_s *heap)
       heap_impl->mm_counts_held = 1;
     }
 
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
   mseminfo("Holder=%d count=%d\n", heap_impl->mm_holder,
             heap_impl->mm_counts_held);
 }
@@ -266,9 +250,6 @@ void mm_takesemaphore(FAR struct mm_heap_s *heap)
 void mm_givesemaphore(FAR struct mm_heap_s *heap)
 {
   FAR struct mm_heap_impl_s *heap_impl;
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
 
   DEBUGASSERT(MM_IS_VALID(heap));
   heap_impl = heap->mm_impl;
@@ -299,8 +280,4 @@ void mm_givesemaphore(FAR struct mm_heap_s *heap)
       heap_impl->mm_counts_held = 0;
       DEBUGVERIFY(_SEM_POST(&heap_impl->mm_semaphore));
     }
-
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
 }