mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
kernel/vm: Try expanding upwards from the last allocated range.
The most likely case is that the last range is the one we actually want to try expanding, so this should be a slight efficiency gain. But it also will help in avoiding allocating "low" memory when it isn't necessary.
This commit is contained in:
parent
bb7ace43c2
commit
12357279a8
@ -4341,12 +4341,12 @@ vm_allocate_early_physical_page(kernel_args* args)
|
||||
}
|
||||
|
||||
// Try expanding the existing physical ranges upwards.
|
||||
for (uint32 i = 0; i < args->num_physical_allocated_ranges; i++) {
|
||||
for (int32 i = args->num_physical_allocated_ranges - 1; i > 0; i--) {
|
||||
addr_range& range = args->physical_allocated_range[i];
|
||||
phys_addr_t nextPage = range.start + range.size;
|
||||
|
||||
// make sure the next page does not collide with the next allocated range
|
||||
if ((i + 1) < args->num_physical_allocated_ranges) {
|
||||
if ((i + 1) < (int32)args->num_physical_allocated_ranges) {
|
||||
addr_range& nextRange = args->physical_allocated_range[i + 1];
|
||||
if (nextRange.size != 0 && nextPage >= nextRange.start)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user