From a0bde21f0f2b8694cf3f60efe1e665dc15c340e5 Mon Sep 17 00:00:00 2001 From: wangbowen6 Date: Wed, 30 Mar 2022 20:31:29 +0800 Subject: [PATCH] mm/mm_heap: place alloc-bit at the LSB of node->preceeding. Heap always allocate the memory at least 2bytes alignment. Signed-off-by: wangbowen6 --- mm/mm_heap/mm.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h index af89268a50..9ea235ecd3 100644 --- a/mm/mm_heap/mm.h +++ b/mm/mm_heap/mm.h @@ -124,15 +124,14 @@ #define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK) #define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK) -/* An allocated chunk is distinguished from a free chunk by bit 31 (or 15) +/* An allocated chunk is distinguished from a free chunk by bit 0 * of the 'preceding' chunk size. If set, then this is an allocated chunk. */ +#define MM_ALLOC_BIT 0x1 #ifdef CONFIG_MM_SMALL -# define MM_ALLOC_BIT 0x8000 # define MMSIZE_MAX UINT16_MAX #else -# define MM_ALLOC_BIT 0x80000000 # define MMSIZE_MAX UINT32_MAX #endif