Commit bed76b96 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: kill MAP_NR, dont mark free_initmem as __init

parent 90047b4b
...@@ -392,38 +392,32 @@ __flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) ...@@ -392,38 +392,32 @@ __flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end)
flush_hash_range(context, i, local); flush_hash_range(context, i, local);
} }
void free_initmem(void)
void __init free_initmem(void)
{ {
unsigned long a; unsigned long addr;
unsigned long num_freed_pages = 0;
#define FREESEC(START,END,CNT) do { \ addr = (unsigned long)(&__init_begin);
a = (unsigned long)(&START); \ for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
for (; a < (unsigned long)(&END); a += PAGE_SIZE) { \ ClearPageReserved(virt_to_page(addr));
clear_bit(PG_reserved, &mem_map[MAP_NR(a)].flags); \ set_page_count(virt_to_page(addr), 1);
set_page_count(mem_map+MAP_NR(a), 1); \ free_page(addr);
free_page(a); \ totalram_pages++;
CNT++; \ }
} \ printk ("Freeing unused kernel memory: %dk freed\n",
} while (0) (&__init_end - &__init_begin) >> 10);
FREESEC(__init_begin,__init_end,num_freed_pages);
printk ("Freeing unused kernel memory: %ldk init\n",
PGTOKB(num_freed_pages));
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
unsigned long xstart = start; if (start < end)
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
for (; start < end; start += PAGE_SIZE) { for (; start < end; start += PAGE_SIZE) {
ClearPageReserved(mem_map + MAP_NR(start)); ClearPageReserved(virt_to_page(start));
set_page_count(mem_map+MAP_NR(start), 1); set_page_count(virt_to_page(start), 1);
free_page(start); free_page(start);
totalram_pages++; totalram_pages++;
} }
printk ("Freeing initrd memory: %ldk freed\n", (end - xstart) >> 10);
} }
#endif #endif
...@@ -572,11 +566,11 @@ void __init mem_init(void) ...@@ -572,11 +566,11 @@ void __init mem_init(void)
for (addr = (unsigned long)sysmap; for (addr = (unsigned long)sysmap;
addr < PAGE_ALIGN((unsigned long)sysmap+sysmap_size) ; addr < PAGE_ALIGN((unsigned long)sysmap+sysmap_size) ;
addr += PAGE_SIZE) addr += PAGE_SIZE)
SetPageReserved(mem_map + MAP_NR(addr)); SetPageReserved(virt_to_page(addr));
for (addr = KERNELBASE; addr <= (unsigned long)__va(lmb_end_of_DRAM()); for (addr = KERNELBASE; addr <= (unsigned long)__va(lmb_end_of_DRAM());
addr += PAGE_SIZE) { addr += PAGE_SIZE) {
if (!PageReserved(mem_map + MAP_NR(addr))) if (!PageReserved(virt_to_page(addr)))
continue; continue;
if (addr < (ulong) etext) if (addr < (ulong) etext)
codepages++; codepages++;
......
...@@ -222,8 +222,6 @@ static inline int get_order(unsigned long size) ...@@ -222,8 +222,6 @@ static inline int get_order(unsigned long size)
#define pfn_valid(pfn) ((pfn) < max_mapnr) #define pfn_valid(pfn) ((pfn) < max_mapnr)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
* for zero-mapped memory areas etc.. * for zero-mapped memory areas etc..
*/ */
extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)]; extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page)) #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
/* shift to put page number into pte */ /* shift to put page number into pte */
......
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