Subversion Repositories HelenOS-historic

Rev

Rev 1063 | Rev 1196 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1063 Rev 1093
Line 535... Line 535...
535
    for (i = 0; i < z->count; i++) {
535
    for (i = 0; i < z->count; i++) {
536
        /* This marks all frames busy */
536
        /* This marks all frames busy */
537
        frame_initialize(&z->frames[i]);
537
        frame_initialize(&z->frames[i]);
538
    }
538
    }
539
    /* Copy frames from both zones to preserve full frame orders,
539
    /* Copy frames from both zones to preserve full frame orders,
540
     * parents etc. Set all frames with refcount=0 to 1, because
540
     * parents etc. Set all free frames with refcount=0 to 1, because
541
     * we add all free frames to buddy allocator later again, clear
541
     * we add all free frames to buddy allocator later again, clear
-
 
542
     * order to 0. Don't set busy frames with refcount=0, as they
-
 
543
     * will not be reallocated during merge and it would make later
542
     * order to 0.
544
     * problems with allocation/free.
543
     */
545
     */
544
    for (i=0; i<z1->count; i++)
546
    for (i=0; i<z1->count; i++)
545
        z->frames[i] = z1->frames[i];
547
        z->frames[i] = z1->frames[i];
546
    for (i=0; i < z2->count; i++) {
548
    for (i=0; i < z2->count; i++) {
547
        z2idx = i + (z2->base - z1->base);
549
        z2idx = i + (z2->base - z1->base);
548
        z->frames[z2idx] = z2->frames[i];
550
        z->frames[z2idx] = z2->frames[i];
549
    }
551
    }
-
 
552
    i = 0;
550
    for (i=0; i < z->count; i++) {
553
    while (i < z->count) {
551
        if (!z->frames[i].refcount) {
554
        if (z->frames[i].refcount) {
-
 
555
            /* skip busy frames */
-
 
556
            i += 1 << z->frames[i].buddy_order;
-
 
557
        } else { /* Free frames, set refcount=1 */
-
 
558
            /* All free frames have refcount=0, we need not
-
 
559
             * to check the order */
552
            z->frames[i].refcount = 1;
560
            z->frames[i].refcount = 1;
553
            z->frames[i].buddy_order = 0;
561
            z->frames[i].buddy_order = 0;
-
 
562
            i++;
554
        }
563
        }
555
    }
564
    }
556
    /* Add free blocks from the 2 original zones */
565
    /* Add free blocks from the 2 original zones */
557
    while (zone_can_alloc(z1, 0)) {
566
    while (zone_can_alloc(z1, 0)) {
558
        frame_idx = zone_frame_alloc(z1, 0);
567
        frame_idx = zone_frame_alloc(z1, 0);