mm:Fix the problem that the memdump statistics of blkcont are inconsistent

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-06-19 11:16:46 +08:00 committed by Xiang Xiao
parent 49afeb4d63
commit 79c0fafc06
4 changed files with 13 additions and 6 deletions

View File

@ -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] = "";

View File

@ -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)
{

View File

@ -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
{

View File

@ -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
{