Changeset 2ec725f in mainline for kernel/generic/src/mm/frame.c


Ignore:
Timestamp:
2008-07-06T18:20:02Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5f7a0ef
Parents:
000350f8
Message:

Avoid deadlock during the 'zone n' kconsole command. Buddy allocator detail is
no longer printed because the effort to avoid the deadlock was simply not worth
it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/frame.c

    r000350f8 r2ec725f  
    319319}
    320320
    321 static void zone_buddy_print_id(buddy_system_t *b, link_t *block)
    322 {
    323         frame_t *frame;
    324         zone_t *zone;
    325         index_t index;
    326 
    327         frame = list_get_instance(block, frame_t, buddy_link);
    328         zone = (zone_t *) b->data;
    329         index = frame_index(zone, frame);
    330         printf("%" PRIi, index);
    331 }                                   
    332 
    333321/** Buddy system find_buddy implementation.
    334322 *
     
    470458        .mark_busy = zone_buddy_mark_busy,
    471459        .mark_available = zone_buddy_mark_available,
    472         .find_block = zone_buddy_find_block,
    473         .print_id = zone_buddy_print_id
     460        .find_block = zone_buddy_find_block
    474461};
    475462
     
    12841271        ipl_t ipl;
    12851272        unsigned int i;
     1273        uintptr_t base;
     1274        count_t count;
     1275        count_t busy_count;
     1276        count_t free_count;
    12861277
    12871278        ipl = interrupts_disable();
     
    12951286        }
    12961287        if (!zone) {
     1288                spinlock_unlock(&zones.lock);
     1289                interrupts_restore(ipl);
    12971290                printf("Zone not found.\n");
    1298                 goto out;
     1291                return;
    12991292        }
    13001293       
    13011294        spinlock_lock(&zone->lock);
    1302         printf("Memory zone information\n");
    1303         printf("Zone base address: %p\n", PFN2ADDR(zone->base));
    1304         printf("Zone size: %" PRIc " frames (%" PRIs " KB)\n", zone->count,
    1305             SIZE2KB(FRAMES2SIZE(zone->count)));
    1306         printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n",
    1307             zone->busy_count, SIZE2KB(FRAMES2SIZE(zone->busy_count)));
    1308         printf("Available space: %" PRIc " frames (%" PRIs " KB)\n",
    1309             zone->free_count, SIZE2KB(FRAMES2SIZE(zone->free_count)));
    1310         buddy_system_structure_print(zone->buddy_system, FRAME_SIZE);
     1295        base = PFN2ADDR(zone->base);
     1296        count = zone->count;
     1297        busy_count = zone->busy_count;
     1298        free_count = zone->free_count;
    13111299        spinlock_unlock(&zone->lock);
    1312        
    1313 out:
    13141300        spinlock_unlock(&zones.lock);
    13151301        interrupts_restore(ipl);
     1302
     1303        printf("Zone base address: %p\n", base);
     1304        printf("Zone size: %" PRIc " frames (%" PRIs " KiB)\n", count,
     1305            SIZE2KB(FRAMES2SIZE(count)));
     1306        printf("Allocated space: %" PRIc " frames (%" PRIs " KiB)\n",
     1307            busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
     1308        printf("Available space: %" PRIc " frames (%" PRIs " KiB)\n",
     1309            free_count, SIZE2KB(FRAMES2SIZE(free_count)));
    13161310}
    13171311
Note: See TracChangeset for help on using the changeset viewer.