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/25 10:17:37 UTC
[nuttx] 01/03: mm:Fix the problem that the memdump statistics of blkcont are inconsistent
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 79c0fafc06e71ff8af902b9704ea859d04f5024d
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Mon Jun 19 11:16:46 2023 +0800
mm:Fix the problem that the memdump statistics of blkcont are inconsistent
Signed-off-by: anjiahao <an...@xiaomi.com>
---
mm/mempool/mempool.c | 5 +++--
mm/mm_heap/mm_mallinfo.c | 3 ++-
mm/mm_heap/mm_memdump.c | 4 +++-
mm/tlsf/mm_tlsf.c | 7 +++++--
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c
index 061dbd5b38..55fdcc7f67 100644
--- a/mm/mempool/mempool.c
+++ b/mm/mempool/mempool.c
@@ -425,7 +425,7 @@ mempool_info_task(FAR struct mempool_s *pool,
list_for_every_entry(&pool->alist, buf, struct mempool_backtrace_s,
node)
{
- if ((task->pid == PID_MM_ALLOC || task->pid == buf->pid ||
+ if ((task->pid == buf->pid || task->pid == PID_MM_ALLOC ||
(task->pid == PID_MM_LEAK && !!nxsched_get_tcb(buf->pid))) &&
buf->seqno >= task->seqmin && buf->seqno <= task->seqmax)
{
@@ -488,7 +488,8 @@ void mempool_memdump(FAR struct mempool_s *pool,
list_for_every_entry(&pool->alist, buf,
struct mempool_backtrace_s, node)
{
- if ((dump->pid == PID_MM_ALLOC || dump->pid == buf->pid) &&
+ if ((dump->pid == buf->pid || dump->pid == PID_MM_ALLOC ||
+ (dump->pid == PID_MM_LEAK && !!nxsched_get_tcb(buf->pid))) &&
buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
{
char tmp[CONFIG_MM_BACKTRACE * MM_PTR_FMT_WIDTH + 1] = "";
diff --git a/mm/mm_heap/mm_mallinfo.c b/mm/mm_heap/mm_mallinfo.c
index 7257ef246c..a0f1453558 100644
--- a/mm/mm_heap/mm_mallinfo.c
+++ b/mm/mm_heap/mm_mallinfo.c
@@ -104,7 +104,8 @@ static void mallinfo_task_handler(FAR struct mm_allocnode_s *node,
info->uordblks += nodesize;
}
#else
- if ((task->pid == PID_MM_ALLOC || task->pid == node->pid ||
+ if ((task->pid == node->pid ||
+ (task->pid == PID_MM_ALLOC && node->pid != PID_MM_MEMPOOL) ||
(task->pid == PID_MM_LEAK && !!nxsched_get_tcb(node->pid))) &&
node->seqno >= task->seqmin && node->seqno <= task->seqmax)
{
diff --git a/mm/mm_heap/mm_memdump.c b/mm/mm_heap/mm_memdump.c
index 3caa77fd0a..57b831982b 100644
--- a/mm/mm_heap/mm_memdump.c
+++ b/mm/mm_heap/mm_memdump.c
@@ -61,7 +61,9 @@ static void memdump_handler(FAR struct mm_allocnode_s *node, FAR void *arg)
#if CONFIG_MM_BACKTRACE < 0
if (dump->pid == PID_MM_ALLOC)
#else
- if ((dump->pid == PID_MM_ALLOC || dump->pid == node->pid) &&
+ if ((dump->pid == node->pid ||
+ (dump->pid == PID_MM_ALLOC && node->pid != PID_MM_MEMPOOL) ||
+ (dump->pid == PID_MM_LEAK && !!nxsched_get_tcb(node->pid))) &&
node->seqno >= dump->seqmin && node->seqno <= dump->seqmax)
#endif
{
diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c
index bfe2e6cb94..fbea79708d 100644
--- a/mm/tlsf/mm_tlsf.c
+++ b/mm/tlsf/mm_tlsf.c
@@ -296,7 +296,8 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
FAR struct memdump_backtrace_s *buf =
ptr + size - sizeof(struct memdump_backtrace_s);
- if ((task->pid == PID_MM_ALLOC || task->pid == buf->pid ||
+ if ((task->pid == buf->pid ||
+ (task->pid == PID_MM_ALLOC && buf->pid != PID_MM_MEMPOOL) ||
(task->pid == PID_MM_LEAK && !!nxsched_get_tcb(buf->pid))) &&
buf->seqno >= task->seqmin && buf->seqno <= task->seqmax)
{
@@ -408,7 +409,9 @@ static void memdump_handler(FAR void *ptr, size_t size, int used,
FAR struct memdump_backtrace_s *buf =
ptr + size - sizeof(struct memdump_backtrace_s);
- if ((dump->pid == PID_MM_ALLOC || dump->pid == buf->pid) &&
+ if ((dump->pid == buf->pid ||
+ (dump->pid == PID_MM_ALLOC && buf->pid != PID_MM_MEMPOOL) ||
+ (dump->pid == PID_MM_LEAK && !!nxsched_get_tcb(buf->pid))) &&
buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
#endif
{