Changeset 8a9a41e in mainline for kernel/generic/src/mm/frame.c
- Timestamp:
- 2021-10-24T08:28:43Z (2 years ago)
- Children:
- f628215
- Parents:
- 2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/frame.c
r2ce943a r8a9a41e 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 frame_initialize(&zones.info[z1].frames[old_z1->count + i]); 522 zone_mark_unavailable(&zones.info[z1], old_z1->count + i); 523 } 494 524 } 495 525 … … 518 548 519 549 for (size_t i = 0; i < cframes; i++) 520 (void) zone_frame_free(&zones.info[znum],550 zone_mark_available(&zones.info[znum], 521 551 pfn - zones.info[znum].base + i); 522 552 }
Note:
See TracChangeset
for help on using the changeset viewer.