arch: let arch_memory_regions return all available regions

The previous `arch_memory_regions` function will provide some memory
regions with the specified memory size and fill all the previous
regions before using the next one, but sometimes there may be no need
to fill up the previous one, e.g., the previous one should be aligned
with hugepage size.

This commit make `arch_memory_regions` function not take any
parameters and return the max available regions, the memory manager
can use them on demand.

Fixes: #5463

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
This commit is contained in:
Yu Li
2023-06-07 12:01:17 +08:00
committed by Bo Chen
parent c10de48f08
commit e5835fdc75
3 changed files with 51 additions and 140 deletions

View File

@@ -933,7 +933,7 @@ impl MemoryManager {
)
} else {
// Init guest memory
let arch_mem_regions = arch::arch_memory_regions(ram_size);
let arch_mem_regions = arch::arch_memory_regions();
let ram_regions: Vec<(GuestAddress, usize)> = arch_mem_regions
.iter()