Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 700 → Rev 701

/kernel/trunk/generic/src/mm/buddy.c
231,8 → 231,6
 
}
 
 
 
/** Prints out structure of buddy system
*
* @param b Pointer to buddy system
250,15 → 248,16
for (i=0;i < b->max_order; i++) {
cnt = 0;
if (!list_empty(&b->order[i])) {
for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) cnt++;
for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next)
cnt++;
}
printf("#%d\t%d\t%d kb\t\t%d kb\t\t%d\n", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i);
printf("#%d\t%d\t%dK\t\t%dK\t\t%d\n", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i);
block_count += cnt;
elem_count += (1 << i) * cnt;
}
printf("-----\t------\t--------\t----------\t---------------\n");
printf("Buddy system contains %d elements (%d blocks)\n" , elem_count, block_count);
printf("Buddy system contains %d free elements (%d blocks)\n" , elem_count, block_count);
 
}
/kernel/trunk/generic/src/mm/frame.c
117,8 → 117,6
if (flags & FRAME_PANIC)
panic("Can't allocate frame.\n");
/*
* TODO: Sleep until frames are available again.
*/
155,7 → 153,6
spinlock_unlock(&zone_head_lock);
interrupts_restore(ipl);
 
 
if (flags & FRAME_KA)
v = PA2KA(v);
205,6 → 202,7
zone = z;
break;
}
 
spinlock_unlock(&z->lock);
}
502,6 → 500,9
void zone_print_list(void) {
zone_t *zone = NULL;
link_t *cur;
ipl_t ipl;
 
ipl = interrupts_disable();
spinlock_lock(&zone_head_lock);
printf("Base address\tFree Frames\tBusy Frames\n");
printf("------------\t-----------\t-----------\n");
509,9 → 510,10
zone = list_get_instance(cur, zone_t, link);
spinlock_lock(&zone->lock);
printf("%L\t%d\t\t%d\n",zone->base, zone->free_count, zone->busy_count);
spinlock_unlock(&zone->lock);
}
spinlock_unlock(&zone_head_lock);
 
interrupts_restore(ipl);
}
 
/** Prints zone details
521,11 → 523,11
void zone_print_one(__address base) {
zone_t *zone = NULL, *z ;
link_t *cur;
ipl_t ipl;
 
ipl = interrupts_disable();
spinlock_lock(&zone_head_lock);
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
z = list_get_instance(cur, zone_t, link);
if (base == z->base) {
534,8 → 536,9
}
}
if (!zone) {
spinlock_unlock(&zone_head_lock);
interrupts_restore(ipl);
printf("No zone with address %X\n", base);
return;
}
543,9 → 546,9
spinlock_lock(&zone->lock);
printf("Memory zone information\n\n");
printf("Zone base address: %P\n", zone->base);
printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
printf("Zone size: %d frames (%dK)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
printf("Allocated space: %d frames (%dK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
printf("Available space: %d (%dK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
printf("\nBuddy allocator structures:\n\n");
buddy_system_structure_print(zone->buddy_system, FRAME_SIZE);
552,6 → 555,6
spinlock_unlock(&zone->lock);
spinlock_unlock(&zone_head_lock);
interrupts_restore(ipl);
}