mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 12:00:58 +07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6: lmb: Fix reserved region handling in lmb_enforce_memory_limit(). sparc64: Fix cmdline_memory_size handling bugs. sparc64: Fix overshoot in nid_range().
This commit is contained in:
commit
1de481ded9
@ -796,6 +796,9 @@ static unsigned long nid_range(unsigned long start, unsigned long end,
|
||||
start += PAGE_SIZE;
|
||||
}
|
||||
|
||||
if (start > end)
|
||||
start = end;
|
||||
|
||||
return start;
|
||||
}
|
||||
#else
|
||||
@ -1723,8 +1726,7 @@ void __init paging_init(void)
|
||||
|
||||
find_ramdisk(phys_base);
|
||||
|
||||
if (cmdline_memory_size)
|
||||
lmb_enforce_memory_limit(phys_base + cmdline_memory_size);
|
||||
lmb_enforce_memory_limit(cmdline_memory_size);
|
||||
|
||||
lmb_analyze();
|
||||
lmb_dump_all();
|
||||
@ -1961,6 +1963,15 @@ void __init mem_init(void)
|
||||
void free_initmem(void)
|
||||
{
|
||||
unsigned long addr, initend;
|
||||
int do_free = 1;
|
||||
|
||||
/* If the physical memory maps were trimmed by kernel command
|
||||
* line options, don't even try freeing this initmem stuff up.
|
||||
* The kernel image could have been in the trimmed out region
|
||||
* and if so the freeing below will free invalid page structs.
|
||||
*/
|
||||
if (cmdline_memory_size)
|
||||
do_free = 0;
|
||||
|
||||
/*
|
||||
* The init section is aligned to 8k in vmlinux.lds. Page align for >8k pagesizes.
|
||||
@ -1975,13 +1986,16 @@ void free_initmem(void)
|
||||
((unsigned long) __va(kern_base)) -
|
||||
((unsigned long) KERNBASE));
|
||||
memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
|
||||
p = virt_to_page(page);
|
||||
|
||||
ClearPageReserved(p);
|
||||
init_page_count(p);
|
||||
__free_page(p);
|
||||
num_physpages++;
|
||||
totalram_pages++;
|
||||
if (do_free) {
|
||||
p = virt_to_page(page);
|
||||
|
||||
ClearPageReserved(p);
|
||||
init_page_count(p);
|
||||
__free_page(p);
|
||||
num_physpages++;
|
||||
totalram_pages++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,6 +462,8 @@ void __init lmb_enforce_memory_limit(u64 memory_limit)
|
||||
if (lmb.memory.region[0].size < lmb.rmo_size)
|
||||
lmb.rmo_size = lmb.memory.region[0].size;
|
||||
|
||||
memory_limit = lmb_end_of_DRAM();
|
||||
|
||||
/* And truncate any reserves above the limit also. */
|
||||
for (i = 0; i < lmb.reserved.cnt; i++) {
|
||||
p = &lmb.reserved.region[i];
|
||||
|
Loading…
Reference in New Issue
Block a user