Commit 1de481de authored by Linus Torvalds's avatar Linus Torvalds

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().
parents abcf4241 ebb1951d
......@@ -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,6 +1986,8 @@ void free_initmem(void)
((unsigned long) __va(kern_base)) -
((unsigned long) KERNBASE));
memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
if (do_free) {
p = virt_to_page(page);
ClearPageReserved(p);
......@@ -1983,6 +1996,7 @@ void free_initmem(void)
num_physpages++;
totalram_pages++;
}
}
}
#ifdef CONFIG_BLK_DEV_INITRD
......
......@@ -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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment