forked from luck/tmp_suning_uos_patched
xen: clean up "extra" memory handling some more
Make sure that extra_pages is added for all E820_RAM regions beyond mem_end - completely excluded regions as well as the remains of partially included regions. Also makes sure the extra region is not unnecessarily high, and simplifies the logic to decide which regions should be added. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
This commit is contained in:
parent
1233471572
commit
c2d0879112
|
@ -182,24 +182,21 @@ char * __init xen_memory_setup(void)
|
|||
for (i = 0; i < memmap.nr_entries; i++) {
|
||||
unsigned long long end = map[i].addr + map[i].size;
|
||||
|
||||
if (map[i].type == E820_RAM) {
|
||||
if (map[i].addr < mem_end && end > mem_end) {
|
||||
/* Truncate region to max_mem. */
|
||||
u64 delta = end - mem_end;
|
||||
if (map[i].type == E820_RAM && end > mem_end) {
|
||||
/* RAM off the end - may be partially included */
|
||||
u64 delta = min(map[i].size, end - mem_end);
|
||||
|
||||
map[i].size -= delta;
|
||||
extra_pages += PFN_DOWN(delta);
|
||||
map[i].size -= delta;
|
||||
end -= delta;
|
||||
|
||||
end = mem_end;
|
||||
}
|
||||
extra_pages += PFN_DOWN(delta);
|
||||
}
|
||||
|
||||
if (end > xen_extra_mem_start)
|
||||
if (map[i].size > 0 && end > xen_extra_mem_start)
|
||||
xen_extra_mem_start = end;
|
||||
|
||||
/* If region is non-RAM or below mem_end, add what remains */
|
||||
if ((map[i].type != E820_RAM || map[i].addr < mem_end) &&
|
||||
map[i].size > 0)
|
||||
/* Add region if any remains */
|
||||
if (map[i].size > 0)
|
||||
e820_add_region(map[i].addr, map[i].size, map[i].type);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user