Changeset 328f2934 in mainline for generic/src/mm/buddy.c
- Timestamp:
- 2005-12-04T19:37:13Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cf585c9
- Parents:
- d7ac642
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/buddy.c
rd7ac642 r328f2934 34 34 #include <list.h> 35 35 #include <debug.h> 36 #include <print.h> 36 37 37 38 /** Create buddy system … … 57 58 ASSERT(op->bisect); 58 59 ASSERT(op->coalesce); 60 ASSERT(op->mark_busy); 59 61 60 62 /* … … 84 86 } 85 87 88 /** Check if buddy system can allocate block 89 * 90 * @param b Buddy system pointer 91 * @param i Size of the block (2^i) 92 * 93 * @return True if block can be allocated 94 */ 95 bool buddy_system_can_alloc(buddy_system_t *b, __u8 i) { 96 __u8 k; 97 98 ASSERT(i < b->max_order); 99 100 for (k=i; k < b->max_order; k++) { 101 if (!list_empty(&b->order[k])) { 102 return true; 103 } 104 } 105 106 return false; 107 108 } 109 86 110 /** Allocate block from buddy system. 87 111 * … … 104 128 res = b->order[i].next; 105 129 list_remove(res); 130 b->op->mark_busy(b, res); 106 131 return res; 107 132 } … … 137 162 /* 138 163 * Return the other half to buddy system. 139 */ 164 * PROBLEM!!!! FILL FIND OTHER PART AS BUDDY AND LINK TOGETHER 165 */ 166 b->op->mark_busy(b, res); 140 167 buddy_system_free(b, hlp); 141 168 … … 153 180 link_t *buddy, *hlp; 154 181 __u8 i; 155 182 156 183 /* 157 184 * Determine block's order. … … 169 196 170 197 ASSERT(b->op->get_order(b, buddy) == i); 171 172 198 /* 173 199 * Remove buddy from the list of order i.
Note:
See TracChangeset
for help on using the changeset viewer.