mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
mempool:fix bug when use MM_BACKTRACE
caculate blk address when mempool_multiple_free have a bug. need a real blocksize to caulate the memory address. Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -34,6 +34,18 @@
|
||||
#include <nuttx/spinlock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
# define MEMPOOL_REALBLOCKSIZE(pool) (ALIGN_UP(pool->blocksize + \
|
||||
sizeof(struct mempool_backtrace_s), \
|
||||
pool->blockalign))
|
||||
#else
|
||||
# define MEMPOOL_REALBLOCKSIZE(pool) (pool->blocksize)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -70,6 +82,9 @@ struct mempool_procfs_entry_s
|
||||
struct mempool_s
|
||||
{
|
||||
size_t blocksize; /* The size for every block in mempool */
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
size_t blockalign; /* The alignment of the blocksize */
|
||||
#endif
|
||||
size_t initialsize; /* The initialize size in normal mempool */
|
||||
size_t interruptsize; /* The initialize size in interrupt mempool */
|
||||
size_t expandsize; /* The size of expand block every time for mempool */
|
||||
@@ -101,6 +116,17 @@ struct mempool_s
|
||||
#endif
|
||||
};
|
||||
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
struct mempool_backtrace_s
|
||||
{
|
||||
FAR struct list_node node;
|
||||
pid_t pid;
|
||||
# if CONFIG_MM_BACKTRACE > 0
|
||||
FAR void *backtrace[CONFIG_MM_BACKTRACE];
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
struct mempoolinfo_s
|
||||
{
|
||||
unsigned long arena; /* This is the total size of mempool */
|
||||
|
||||
Reference in New Issue
Block a user