Merge tag 'asoc-fix-v4.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brooni...
[deliverable/linux.git] / arch / powerpc / mm / pgtable_64.c
index cdf2123d46db4813a4e87f30d29f8da359c313d9..347106080bb1e64b87d28477db24e47f3ab3ef77 100644 (file)
@@ -88,7 +88,7 @@ static __ref void *early_alloc_pgtable(unsigned long size)
  * map_kernel_page adds an entry to the ioremap page table
  * and adds an entry to the HPT, possibly bolting it
  */
-int map_kernel_page(unsigned long ea, unsigned long pa, int flags)
+int map_kernel_page(unsigned long ea, unsigned long pa, unsigned long flags)
 {
        pgd_t *pgdp;
        pud_t *pudp;
@@ -403,7 +403,7 @@ static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
         * count.
         */
        if (likely(!mm->context.pte_frag)) {
-               atomic_set(&page->_count, PTE_FRAG_NR);
+               set_page_count(page, PTE_FRAG_NR);
                mm->context.pte_frag = ret + PTE_FRAG_SIZE;
        }
        spin_unlock(&mm->page_table_lock);
@@ -749,7 +749,7 @@ pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
 {
        unsigned long pmdv;
 
-       pmdv = pfn << PTE_RPN_SHIFT;
+       pmdv = (pfn << PTE_RPN_SHIFT) & PTE_RPN_MASK;
        return pmd_set_protbits(__pmd(pmdv), pgprot);
 }
 
@@ -817,6 +817,13 @@ pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
 
 int has_transparent_hugepage(void)
 {
+
+       BUILD_BUG_ON_MSG((PMD_SHIFT - PAGE_SHIFT) >= MAX_ORDER,
+               "hugepages can't be allocated by the buddy allocator");
+
+       BUILD_BUG_ON_MSG((PMD_SHIFT - PAGE_SHIFT) < 2,
+                        "We need more than 2 pages to do deferred thp split");
+
        if (!mmu_has_feature(MMU_FTR_16M_PAGE))
                return 0;
        /*
This page took 0.032934 seconds and 5 git commands to generate.