mm: Unified memory management alignment length

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2024-12-30 15:03:13 +08:00 • committed by Xiang Xiao
parent da845163a3
commit b27dc9ee7f
3 changed files with 8 additions and 12 deletions

View file

@ -41,16 +41,10 @@
* Pre-processor Definitions
****************************************************************************/
#if CONFIG_MM_DEFAULT_ALIGNMENT == 0
# define MEMPOOL_ALIGN (2 * sizeof(uintptr_t))
#else
# define MEMPOOL_ALIGN CONFIG_MM_DEFAULT_ALIGNMENT
#endif
#if CONFIG_MM_BACKTRACE >= 0
# define MEMPOOL_REALBLOCKSIZE(pool) (ALIGN_UP((pool)->blocksize + \
sizeof(struct mempool_backtrace_s), \
MEMPOOL_ALIGN))
MM_ALIGN))
#else
# define MEMPOOL_REALBLOCKSIZE(pool) ((pool)->blocksize)
#endif

View file

@ -156,6 +156,12 @@
# define MM_DUMP_LEAK(dump,pid) (false)
#endif
#if CONFIG_MM_DEFAULT_ALIGNMENT == 0
# define MM_ALIGN (2 * sizeof(uintptr_t))
#else
# define MM_ALIGN CONFIG_MM_DEFAULT_ALIGNMENT
#endif
#define MM_INIT_MAGIC 0xcc
#define MM_ALLOC_MAGIC 0xaa
#define MM_FREE_MAGIC 0x55