diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-18 12:03:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-18 12:03:23 -0700 |
commit | 1de481ded98d1d48e2a4102a5aa549e3c4d18ee3 (patch) | |
tree | defeccfeac5a86c349f4cac61a8689f3597d3201 /arch | |
parent | abcf42419d24416175ea8bc9a502d833f64955d1 (diff) | |
parent | ebb1951d3624c2f961abe676645c13e5a1145569 (diff) | |
download | talos-op-linux-1de481ded98d1d48e2a4102a5aa549e3c4d18ee3.tar.gz talos-op-linux-1de481ded98d1d48e2a4102a5aa549e3c4d18ee3.zip |
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().
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc64/mm/init.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 217de3ea29e8..b4aeb0f696dc 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -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++; + } } } |