Rev 3973 | Rev 4230 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3973 | Rev 4048 | ||
---|---|---|---|
Line 158... | Line 158... | ||
158 | * locked. |
158 | * locked. |
159 | * |
159 | * |
160 | * @return Total number of available frames. |
160 | * @return Total number of available frames. |
161 | * |
161 | * |
162 | */ |
162 | */ |
- | 163 | #ifdef CONFIG_DEBUG |
|
163 | static count_t total_frames_free(void) |
164 | static count_t total_frames_free(void) |
164 | { |
165 | { |
165 | count_t total = 0; |
166 | count_t total = 0; |
166 | count_t i; |
167 | count_t i; |
167 | for (i = 0; i < zones.count; i++) |
168 | for (i = 0; i < zones.count; i++) |
168 | total += zones.info[i].free_count; |
169 | total += zones.info[i].free_count; |
169 | 170 | ||
170 | return total; |
171 | return total; |
171 | } |
172 | } |
- | 173 | #endif |
|
172 | 174 | ||
173 | /** Find a zone with a given frames. |
175 | /** Find a zone with a given frames. |
174 | * |
176 | * |
175 | * Assume interrupts are disabled and zones lock is |
177 | * Assume interrupts are disabled and zones lock is |
176 | * locked. |
178 | * locked. |
Line 286... | Line 288... | ||
286 | zone_t *zone = (zone_t *) buddy->data; |
288 | zone_t *zone = (zone_t *) buddy->data; |
287 | ASSERT(IS_BUDDY_ORDER_OK(frame_index_abs(zone, frame), |
289 | ASSERT(IS_BUDDY_ORDER_OK(frame_index_abs(zone, frame), |
288 | frame->buddy_order)); |
290 | frame->buddy_order)); |
289 | 291 | ||
290 | bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame); |
292 | bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame); |
291 | bool is_right = IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame); |
- | |
292 | - | ||
293 | ASSERT(is_left ^ is_right); |
- | |
294 | 293 | ||
295 | index_t index; |
294 | index_t index; |
296 | if (is_left) { |
295 | if (is_left) { |
297 | index = (frame_index(zone, frame)) + |
296 | index = (frame_index(zone, frame)) + |
298 | (1 << frame->buddy_order); |
297 | (1 << frame->buddy_order); |
299 | } else { /* if (is_right) */ |
298 | } else { /* is_right */ |
300 | index = (frame_index(zone, frame)) - |
299 | index = (frame_index(zone, frame)) - |
301 | (1 << frame->buddy_order); |
300 | (1 << frame->buddy_order); |
302 | } |
301 | } |
303 | 302 | ||
304 | if (frame_index_valid(zone, index)) { |
303 | if (frame_index_valid(zone, index)) { |
Line 481... | Line 480... | ||
481 | 480 | ||
482 | frame_t *frame = zone_get_frame(zone, frame_idx); |
481 | frame_t *frame = zone_get_frame(zone, frame_idx); |
483 | if (frame->refcount) |
482 | if (frame->refcount) |
484 | return; |
483 | return; |
485 | 484 | ||
- | 485 | link_t *link __attribute__ ((unused)); |
|
- | 486 | ||
486 | link_t *link = buddy_system_alloc_block(zone->buddy_system, |
487 | link = buddy_system_alloc_block(zone->buddy_system, |
487 | &frame->buddy_link); |
488 | &frame->buddy_link); |
488 | 489 | ||
489 | ASSERT(link); |
490 | ASSERT(link); |
490 | zone->free_count--; |
491 | zone->free_count--; |
491 | } |
492 | } |
Line 606... | Line 607... | ||
606 | 607 | ||
607 | if ((pfn < zones.info[znum].base) |
608 | if ((pfn < zones.info[znum].base) |
608 | || (pfn >= zones.info[znum].base + zones.info[znum].count)) |
609 | || (pfn >= zones.info[znum].base + zones.info[znum].count)) |
609 | return; |
610 | return; |
610 | 611 | ||
611 | frame_t *frame |
612 | frame_t *frame __attribute__ ((unused)); |
- | 613 | ||
612 | = &zones.info[znum].frames[pfn - zones.info[znum].base]; |
614 | frame = &zones.info[znum].frames[pfn - zones.info[znum].base]; |
613 | ASSERT(!frame->buddy_order); |
615 | ASSERT(!frame->buddy_order); |
614 | 616 | ||
615 | count_t i; |
617 | count_t i; |
616 | for (i = 0; i < cframes; i++) { |
618 | for (i = 0; i < cframes; i++) { |
617 | zones.info[znum].busy_count++; |
619 | zones.info[znum].busy_count++; |