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 2023/06/17 11:37:22 UTC

[nuttx] 02/02: mm_heap: dump and stat the mm_heapend node also

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/nuttx.git

commit 372fba70bb2a452f536bfa800932b2b46e1026a5
Author: wangbowen6 <wa...@xiaomi.com>
AuthorDate: Fri Jun 9 14:18:46 2023 +0800

    mm_heap: dump and stat the mm_heapend node also
    
    Signed-off-by: wangbowen6 <wa...@xiaomi.com>
---
 mm/mm_heap/mm_foreach.c  |  1 +
 mm/mm_heap/mm_mallinfo.c | 14 --------------
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/mm/mm_heap/mm_foreach.c b/mm/mm_heap/mm_foreach.c
index b529bfddbd..f9883bde0a 100644
--- a/mm/mm_heap/mm_foreach.c
+++ b/mm/mm_heap/mm_foreach.c
@@ -94,6 +94,7 @@ void mm_foreach(FAR struct mm_heap_s *heap, mm_node_handler_t handler,
       minfo("region=%d node=%p heapend=%p\n",
             region, node, heap->mm_heapend[region]);
       DEBUGASSERT(node == heap->mm_heapend[region]);
+      handler(node, arg);
 
       mm_unlock(heap);
     }
diff --git a/mm/mm_heap/mm_mallinfo.c b/mm/mm_heap/mm_mallinfo.c
index 5295c50e14..66f126ee72 100644
--- a/mm/mm_heap/mm_mallinfo.c
+++ b/mm/mm_heap/mm_mallinfo.c
@@ -140,11 +140,6 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
   struct mallinfo info;
 #if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
   struct mallinfo poolinfo;
-#endif
-#if CONFIG_MM_REGIONS > 1
-  int region = heap->mm_nregions;
-#else
-#  define region 1
 #endif
 
   memset(&info, 0, sizeof(info));
@@ -158,15 +153,6 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
   info.fordblks += poolinfo.fordblks;
 #endif
 
-  /* Account for the heap->mm_heapend[region] node overhead and the
-   * heap->mm_heapstart[region]->preceding:
-   * heap->mm_heapend[region] overhead size     = OVERHEAD_MM_ALLOCNODE
-   * heap->mm_heapstart[region]->preceding size = sizeof(mmsize_t)
-   * and SIZEOF_MM_ALLOCNODE = OVERHEAD_MM_ALLOCNODE + sizeof(mmsize_t).
-   */
-
-  info.uordblks += region * SIZEOF_MM_ALLOCNODE;
-
   DEBUGASSERT((size_t)info.uordblks + info.fordblks == heap->mm_heapsize);
 
   return info;