mm: Move PID_MM_MEMPOOL after PID_MM_ALLOC
so the allocation from mempool could be dumped correctly Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
f01deff80f
commit
b00237ac01
@ -33,10 +33,10 @@
|
||||
|
||||
/* Special PID to query the info about alloc, free and mempool */
|
||||
|
||||
#define PID_MM_INVALID ((pid_t)-4)
|
||||
#define PID_MM_MEMPOOL ((pid_t)-3)
|
||||
#define PID_MM_FREE ((pid_t)-2)
|
||||
#define PID_MM_ALLOC ((pid_t)-1)
|
||||
#define PID_MM_FREE ((pid_t)-4)
|
||||
#define PID_MM_ALLOC ((pid_t)-3)
|
||||
#define PID_MM_INVALID ((pid_t)-2)
|
||||
#define PID_MM_MEMPOOL ((pid_t)-1)
|
||||
|
||||
/* For Linux and MacOS compatibility */
|
||||
|
||||
|
@ -93,7 +93,7 @@ static void memdump_handler(FAR struct mm_allocnode_s *node, FAR void *arg)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (dump->pid == PID_MM_FREE)
|
||||
{
|
||||
FAR struct mm_freenode_s *fnode = (FAR void *)node;
|
||||
|
||||
@ -106,12 +106,9 @@ static void memdump_handler(FAR struct mm_allocnode_s *node, FAR void *arg)
|
||||
SIZEOF_MM_NODE(fnode->flink) == 0 ||
|
||||
SIZEOF_MM_NODE(fnode->flink) >= nodesize);
|
||||
|
||||
if (dump->pid <= PID_MM_FREE)
|
||||
{
|
||||
syslog(LOG_INFO, "%12zu%*p\n",
|
||||
nodesize, MM_PTR_FMT_WIDTH,
|
||||
((FAR char *)node + SIZEOF_MM_ALLOCNODE));
|
||||
}
|
||||
syslog(LOG_INFO, "%12zu%*p\n",
|
||||
nodesize, MM_PTR_FMT_WIDTH,
|
||||
((FAR char *)node + SIZEOF_MM_ALLOCNODE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +132,7 @@ void mm_memdump(FAR struct mm_heap_s *heap,
|
||||
{
|
||||
struct mallinfo_task info;
|
||||
|
||||
if (dump->pid >= -1)
|
||||
if (dump->pid >= PID_MM_ALLOC)
|
||||
{
|
||||
syslog(LOG_INFO, "Dump all used memory node info:\n");
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
|
@ -292,7 +292,7 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
||||
if (used)
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
if (handler->task->pid = PID_MM_ALLOC)
|
||||
if (handler->task->pid == PID_MM_ALLOC)
|
||||
{
|
||||
handler->info->aordblks++;
|
||||
handler->info->uordblks += size;
|
||||
@ -419,10 +419,8 @@ static void memdump_handler(FAR void *ptr, size_t size, int used,
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
if (pid == PID_MM_ALLOC)
|
||||
#else
|
||||
if ((dump->pid == PID_MM_ALLOC ||
|
||||
buf->pid == dump->pid) &&
|
||||
buf->seqno >= dump->seqmin &&
|
||||
buf->seqno <= dump->seqmax)
|
||||
if ((dump->pid == PID_MM_ALLOC || buf->pid == dump->pid) &&
|
||||
buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
|
||||
#endif
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
@ -450,7 +448,7 @@ static void memdump_handler(FAR void *ptr, size_t size, int used,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (dump->pid <= PID_MM_FREE)
|
||||
else if (dump->pid == PID_MM_FREE)
|
||||
{
|
||||
syslog(LOG_INFO, "%12zu%*p\n", size, MM_PTR_FMT_WIDTH, ptr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user