Changeset 263104b in mainline


Ignore:
Timestamp:
2006-01-10T22:43:40Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0369911
Parents:
e30bc2a
Message:

Fix zone_print_one() and zone_print_list().

  • add missing spinlock_unlock()
  • add missing interrupts_disable() and interrupts_restore()

Coding style fixes and cleanup.

Location:
generic/src/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/buddy.c

    re30bc2a r263104b  
    232232}
    233233
    234 
    235 
    236234/** Prints out structure of buddy system
    237235 *
     
    251249                cnt = 0;
    252250                if (!list_empty(&b->order[i])) {
    253                         for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) cnt++;
    254                 }
    255        
    256                 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);
     251                        for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next)
     252                                cnt++;
     253                }
     254       
     255                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);
    257256               
    258257                block_count += cnt;
     
    260259        }
    261260        printf("-----\t------\t--------\t----------\t---------------\n");
    262         printf("Buddy system contains %d elements (%d blocks)\n" , elem_count, block_count);
    263 
    264 }
     261        printf("Buddy system contains %d free elements (%d blocks)\n" , elem_count, block_count);
     262
     263}
  • generic/src/mm/frame.c

    re30bc2a r263104b  
    118118                        panic("Can't allocate frame.\n");
    119119               
    120                
    121                
    122120                /*
    123121                 * TODO: Sleep until frames are available again.
     
    155153        spinlock_unlock(&zone_head_lock);
    156154        interrupts_restore(ipl);
    157 
    158155
    159156        if (flags & FRAME_KA)
     
    206203                        break;
    207204                }
     205
    208206                spinlock_unlock(&z->lock);
    209207        }
     
    503501        zone_t *zone = NULL;
    504502        link_t *cur;
     503        ipl_t ipl;
     504
     505        ipl = interrupts_disable();
    505506        spinlock_lock(&zone_head_lock);
    506507        printf("Base address\tFree Frames\tBusy Frames\n");
     
    510511                spinlock_lock(&zone->lock);
    511512                printf("%L\t%d\t\t%d\n",zone->base, zone->free_count, zone->busy_count);
     513                spinlock_unlock(&zone->lock);
    512514        }
    513515        spinlock_unlock(&zone_head_lock);
    514 
     516        interrupts_restore(ipl);
    515517}
    516518
     
    522524        zone_t *zone = NULL, *z ;
    523525        link_t *cur;
    524        
    525        
     526        ipl_t ipl;
     527
     528        ipl = interrupts_disable();
    526529        spinlock_lock(&zone_head_lock);
    527        
    528530       
    529531        for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
     
    535537        }
    536538       
    537        
    538539        if (!zone) {
     540                spinlock_unlock(&zone_head_lock);
     541                interrupts_restore(ipl);
    539542                printf("No zone with address %X\n", base);
    540543                return;
     
    544547        printf("Memory zone information\n\n");
    545548        printf("Zone base address: %P\n", zone->base);
    546         printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
    547         printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
    548         printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
     549        printf("Zone size: %d frames (%dK)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
     550        printf("Allocated space: %d frames (%dK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
     551        printf("Available space: %d (%dK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
    549552       
    550553        printf("\nBuddy allocator structures:\n\n");
     
    553556        spinlock_unlock(&zone->lock);
    554557        spinlock_unlock(&zone_head_lock);
    555        
    556 }
    557 
     558        interrupts_restore(ipl);
     559}
     560
Note: See TracChangeset for help on using the changeset viewer.