1 /* Copyright (c) 2007, Sandia National Laboratories */
9 * This structure stores the state of a buddy system memory allocator object.
11 struct buddy_mempool {
12 unsigned long base_addr; /* base address of the memory pool */
13 unsigned long pool_order; /* size of memory pool = 2^pool_order */
14 unsigned long min_order; /* minimum allocatable block size */
16 unsigned long num_blocks; /* number of bits in tag_bits */
17 unsigned long *tag_bits; /* one bit for each 2^min_order block
18 * 0 = block is allocated
19 * 1 = block is available
22 struct list_head *avail; /* one free list for each block size,
23 * indexed by block order:
24 * avail[i] = free list of 2^i blocks
28 struct buddy_mempool *
30 unsigned long base_addr,
31 unsigned long pool_order,
32 unsigned long min_order
35 void *buddy_alloc(struct buddy_mempool *mp, unsigned long order);
36 void buddy_free(struct buddy_mempool *mp, void *addr, unsigned long order);
38 void buddy_dump_mempool(struct buddy_mempool *mp);