Changeset 81d3612 in mainline
- Timestamp:
- 2021-09-03T17:44:29Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3c3657c
- Parents:
- 400a16d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/frame.c
r400a16d r81d3612 370 370 { 371 371 assert(zone->flags & ZONE_AVAILABLE); 372 assert(zone->free_count >= count); 372 373 373 374 /* Allocate frames from zone */ … … 410 411 411 412 frame_t *frame = zone_get_frame(zone, index); 412 413 413 assert(frame->refcount > 0); 414 414 415 415 if (!--frame->refcount) { 416 assert(zone->busy_count > 0); 417 416 418 bitmap_set(&zone->bitmap, index, 0); 417 419 … … 432 434 433 435 frame_t *frame = zone_get_frame(zone, index); 436 assert(frame->refcount <= 1); 437 434 438 if (frame->refcount > 0) 435 439 return; 436 440 441 assert(zone->free_count > 0); 442 437 443 frame->refcount = 1; 438 444 bitmap_set_range(&zone->bitmap, index, 1); … … 440 446 zone->free_count--; 441 447 reserve_force_alloc(1); 448 } 449 450 /** Mark frame in zone available to allocation. */ 451 _NO_TRACE static void zone_mark_available(zone_t *zone, size_t index) 452 { 453 assert(zone->flags & ZONE_AVAILABLE); 454 455 frame_t *frame = zone_get_frame(zone, index); 456 assert(frame->refcount == 1); 457 458 frame->refcount = 0; 459 bitmap_set_range(&zone->bitmap, index, 0); 460 461 zone->free_count++; 442 462 } 443 463 … … 465 485 /* Difference between zone bases */ 466 486 pfn_t base_diff = zones.info[z2].base - zones.info[z1].base; 487 pfn_t gap = base_diff - zones.info[z1].count; 467 488 468 489 zones.info[z1].count = base_diff + zones.info[z2].count; … … 492 513 zones.info[z2].frames[i]; 493 514 } 515 516 /* 517 * Mark the gap between the original zones as unavailable. 518 */ 519 520 for (size_t i = 0; i < gap; i++) { 521 zone_mark_unavailable(&zones.info[z1], old_z1->count + i); 522 } 494 523 } 495 524 … … 518 547 519 548 for (size_t i = 0; i < cframes; i++) 520 (void) zone_frame_free(&zones.info[znum],549 zone_mark_available(&zones.info[znum], 521 550 pfn - zones.info[znum].base + i); 522 551 }
Note:
See TracChangeset
for help on using the changeset viewer.