printk("%ld pages shared\n", shared);
printk("%ld pages swap cached\n", cached);
}
+EXPORT_SYMBOL_GPL(show_mem);
#ifdef CONFIG_PPC_ISERIES
int index;
int err;
+#ifdef CONFIG_HUGETLB_PAGE
+ /* We leave htlb_segs as it was, but for a fork, we need to
+ * clear the huge_pgdir. */
+ mm->context.huge_pgdir = NULL;
+#endif
+
again:
if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL))
return -ENOMEM;
spin_lock(&mmu_context_lock);
- err = idr_get_new(&mmu_context_idr, NULL, &index);
+ err = idr_get_new_above(&mmu_context_idr, NULL, 1, &index);
spin_unlock(&mmu_context_lock);
if (err == -EAGAIN)
spin_unlock(&mmu_context_lock);
mm->context.id = NO_CONTEXT;
-}
-
-static int __init mmu_context_init(void)
-{
- int index;
-
- /* Reserve the first (invalid) context*/
- idr_pre_get(&mmu_context_idr, GFP_KERNEL);
- idr_get_new(&mmu_context_idr, NULL, &index);
- BUG_ON(0 != index);
- return 0;
+ hugetlb_mm_free_pgd(mm);
}
-arch_initcall(mmu_context_init);
/*
* Do very early mm setup.
}
EXPORT_SYMBOL(page_is_ram);
+unsigned long next_ram_page(unsigned long pfn)
+{
+ int i;
+ unsigned long paddr, base;
+ unsigned long best_base = (ULONG_MAX << PAGE_SHIFT);
+
+ pfn++;
+ paddr = (pfn << PAGE_SHIFT);
+
+ for (i=0; i < lmb.memory.cnt; i++) {
+#ifdef CONFIG_MSCHUNKS
+ base = lmb.memory.region[i].physbase;
+#else
+ base = lmb.memory.region[i].base;
+#endif
+ if ((paddr >= base)
+ && (paddr < (base + lmb.memory.region[i].size)))
+ return (paddr >> PAGE_SHIFT);
+ if ((paddr < base) && (base < best_base))
+ best_base = base;
+ }
+ if (best_base < (ULONG_MAX << PAGE_SHIFT))
+ return (best_base >> PAGE_SHIFT);
+ else
+ return ULONG_MAX;
+}
+EXPORT_SYMBOL_GPL(next_ram_page);
+
/*
* Initialize the bootmem system and give it all the memory we
* have available.
local_irq_restore(flags);
}
-void * reserve_phb_iospace(unsigned long size)
+void __iomem * reserve_phb_iospace(unsigned long size)
{
- void *virt_addr;
+ void __iomem *virt_addr;
if (phbs_io_bot >= IMALLOC_BASE)
panic("reserve_phb_iospace(): phb io space overflow\n");
- virt_addr = (void *) phbs_io_bot;
+ virt_addr = (void __iomem *) phbs_io_bot;
phbs_io_bot += size;
return virt_addr;