mm_heap/mm.h: revising comments
Revising comments to be in line with code Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
parent
1be1149fdd
commit
813f67f93b
@ -121,8 +121,10 @@
|
|||||||
#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK)
|
#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK)
|
||||||
#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK)
|
#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK)
|
||||||
|
|
||||||
/* An allocated chunk is distinguished from a free chunk by bit 0
|
/* Due to alignment, the lowest two bits of valid chunk size are always
|
||||||
* of the 'preceding' chunk size. If set, then this is an allocated chunk.
|
* zero, thus the two bits are reused to depict allocation status: bit
|
||||||
|
* 0 depicts the allocation state of current chunk, and bit 1 depicts that
|
||||||
|
* of the physically preceding chunk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MM_ALLOC_BIT 0x1
|
#define MM_ALLOC_BIT 0x1
|
||||||
@ -169,14 +171,11 @@ typedef uint16_t mmsize_t;
|
|||||||
typedef size_t mmsize_t;
|
typedef size_t mmsize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This describes an allocated chunk. An allocated chunk is
|
/* This describes an allocated chunk */
|
||||||
* distinguished from a free chunk by bit 15/31 of the 'preceding' chunk
|
|
||||||
* size. If set, then this is an allocated chunk.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct mm_allocnode_s
|
struct mm_allocnode_s
|
||||||
{
|
{
|
||||||
mmsize_t preceding; /* Size of the preceding chunk */
|
mmsize_t preceding; /* Physical preceding chunk size */
|
||||||
mmsize_t size; /* Size of this chunk */
|
mmsize_t size; /* Size of this chunk */
|
||||||
#if CONFIG_MM_BACKTRACE >= 0
|
#if CONFIG_MM_BACKTRACE >= 0
|
||||||
pid_t pid; /* The pid for caller */
|
pid_t pid; /* The pid for caller */
|
||||||
@ -191,7 +190,7 @@ struct mm_allocnode_s
|
|||||||
|
|
||||||
struct mm_freenode_s
|
struct mm_freenode_s
|
||||||
{
|
{
|
||||||
mmsize_t preceding; /* Size of the preceding chunk */
|
mmsize_t preceding; /* Physical preceding chunk size */
|
||||||
mmsize_t size; /* Size of this chunk */
|
mmsize_t size; /* Size of this chunk */
|
||||||
#if CONFIG_MM_BACKTRACE >= 0
|
#if CONFIG_MM_BACKTRACE >= 0
|
||||||
pid_t pid; /* The pid for caller */
|
pid_t pid; /* The pid for caller */
|
||||||
@ -220,9 +219,7 @@ struct mm_delaynode_s
|
|||||||
|
|
||||||
struct mm_heap_s
|
struct mm_heap_s
|
||||||
{
|
{
|
||||||
/* Mutually exclusive access to this data set is enforced with
|
/* Mutex for controling access to this heap */
|
||||||
* the following un-named mutex.
|
|
||||||
*/
|
|
||||||
|
|
||||||
mutex_t mm_lock;
|
mutex_t mm_lock;
|
||||||
|
|
||||||
@ -238,7 +235,7 @@ struct mm_heap_s
|
|||||||
|
|
||||||
size_t mm_curused;
|
size_t mm_curused;
|
||||||
|
|
||||||
/* This is the first and last nodes of the heap */
|
/* The first and last allocated nodes of each region */
|
||||||
|
|
||||||
FAR struct mm_allocnode_s *mm_heapstart[CONFIG_MM_REGIONS];
|
FAR struct mm_allocnode_s *mm_heapstart[CONFIG_MM_REGIONS];
|
||||||
FAR struct mm_allocnode_s *mm_heapend[CONFIG_MM_REGIONS];
|
FAR struct mm_allocnode_s *mm_heapend[CONFIG_MM_REGIONS];
|
||||||
@ -249,14 +246,12 @@ struct mm_heap_s
|
|||||||
|
|
||||||
/* All free nodes are maintained in a doubly linked list. This
|
/* All free nodes are maintained in a doubly linked list. This
|
||||||
* array provides some hooks into the list at various points to
|
* array provides some hooks into the list at various points to
|
||||||
* speed searches for free nodes.
|
* speed up searching of free nodes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct mm_freenode_s mm_nodelist[MM_NNODES];
|
struct mm_freenode_s mm_nodelist[MM_NNODES];
|
||||||
|
|
||||||
/* Free delay list, for some situations where we can't do free
|
/* Free delay list, as sometimes we can't do free immdiately. */
|
||||||
* immdiately.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FAR struct mm_delaynode_s *mm_delaylist[CONFIG_SMP_NCPUS];
|
FAR struct mm_delaynode_s *mm_delaylist[CONFIG_SMP_NCPUS];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user