mm: remove include/linux/bootmem.h
[linux-2.6-block.git] / arch / powerpc / mm / hugetlbpage.c
index e87f9ef9115b41d6a7df4647f5c869f769fc03c0..8cf035e68378b70b99a49261bc02ef28cda026fd 100644 (file)
 #include <linux/export.h>
 #include <linux/of_fdt.h>
 #include <linux/memblock.h>
-#include <linux/bootmem.h>
 #include <linux/moduleparam.h>
 #include <linux/swap.h>
 #include <linux/swapops.h>
+#include <linux/kmemleak.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlb.h>
@@ -95,7 +95,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
                        break;
                else {
 #ifdef CONFIG_PPC_BOOK3S_64
-                       *hpdp = __hugepd(__pa(new) |
+                       *hpdp = __hugepd(__pa(new) | HUGEPD_VAL_BITS |
                                         (shift_to_mmu_psize(pshift) << 2));
 #elif defined(CONFIG_PPC_8xx)
                        *hpdp = __hugepd(__pa(new) | _PMD_USER |
@@ -112,6 +112,8 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
                for (i = i - 1 ; i >= 0; i--, hpdp--)
                        *hpdp = __hugepd(0);
                kmem_cache_free(cachep, new);
+       } else {
+               kmemleak_ignore(new);
        }
        spin_unlock(ptl);
        return 0;
@@ -837,8 +839,12 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
                                ret_pte = (pte_t *) pmdp;
                                goto out;
                        }
-
-                       if (pmd_huge(pmd)) {
+                       /*
+                        * pmd_large check below will handle the swap pmd pte
+                        * we need to do both the check because they are config
+                        * dependent.
+                        */
+                       if (pmd_huge(pmd) || pmd_large(pmd)) {
                                ret_pte = (pte_t *) pmdp;
                                goto out;
                        } else if (is_hugepd(__hugepd(pmd_val(pmd))))