Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[sfrench/cifs-2.6.git] / arch / powerpc / mm / mem.c
index 4bd7b0a70996a6e569790ef8652241d61edb37ba..badac10d700c2949de742b8d1544a9793f5cac86 100644 (file)
@@ -108,25 +108,24 @@ EXPORT_SYMBOL(phys_mem_access_prot);
 void online_page(struct page *page)
 {
        ClearPageReserved(page);
-       set_page_count(page, 0);
-       free_cold_page(page);
+       init_page_count(page);
+       __free_page(page);
        totalram_pages++;
        num_physpages++;
 }
 
-/*
- * This works only for the non-NUMA case.  Later, we'll need a lookup
- * to convert from real physical addresses to nid, that doesn't use
- * pfn_to_nid().
- */
 int __devinit add_memory(u64 start, u64 size)
 {
-       struct pglist_data *pgdata = NODE_DATA(0);
+       struct pglist_data *pgdata;
        struct zone *zone;
+       int nid;
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
 
-       start += KERNELBASE;
+       nid = hot_add_scn_to_nid(start);
+       pgdata = NODE_DATA(nid);
+
+       start = (unsigned long)__va(start);
        create_section_mapping(start, start + size);
 
        /* this should work for most non-highmem platforms */
@@ -250,7 +249,6 @@ void __init do_init_bootmem(void)
        bootmap_pages = bootmem_bootmap_pages(total_pages);
 
        start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
-       BUG_ON(!start);
 
        boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
 
@@ -377,7 +375,7 @@ void __init mem_init(void)
                        struct page *page = pfn_to_page(pfn);
 
                        ClearPageReserved(page);
-                       set_page_count(page, 1);
+                       init_page_count(page);
                        __free_page(page);
                        totalhigh_pages++;
                }
@@ -436,17 +434,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
        clear_page(page);
 
-       if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
-               return;
        /*
         * We shouldnt have to do this, but some versions of glibc
         * require it (ld.so assumes zero filled pages are icache clean)
         * - Anton
         */
-
-       /* avoid an atomic op if possible */
-       if (test_bit(PG_arch_1, &pg->flags))
-               clear_bit(PG_arch_1, &pg->flags);
+       flush_dcache_page(pg);
 }
 EXPORT_SYMBOL(clear_user_page);
 
@@ -470,12 +463,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
                return;
 #endif
 
-       if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
-               return;
-
-       /* avoid an atomic op if possible */
-       if (test_bit(PG_arch_1, &pg->flags))
-               clear_bit(PG_arch_1, &pg->flags);
+       flush_dcache_page(pg);
 }
 
 void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
@@ -495,7 +483,7 @@ EXPORT_SYMBOL(flush_icache_user_range);
  * We use it to preload an HPTE into the hash table corresponding to
  * the updated linux PTE.
  * 
- * This must always be called with the mm->page_table_lock held
+ * This must always be called with the pte lock held.
  */
 void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
                      pte_t pte)