mm, thp: hide remap_try_huge_pmd for the THP-disabled kernel
authorSung-hun Kim <sfoon.kim@samsung.com>
Wed, 15 Sep 2021 07:39:13 +0000 (16:39 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 7 Feb 2022 08:01:41 +0000 (17:01 +0900)
Since remap_try_huge_pmd is dependent on the kernel
configuration CONFIG_TRANSPARENT_HUGEPAGE, it should be
hidden when the kernel configuration is disabled.

Fixes: 90eb23660fef ('mm: THP: introducing a fine-grained transparent hugepage technique for ARM64 architecture')
Change-Id: Iae9efb2edf6cd563c794af68bea7987110a5b2da
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
mm/memory.c

index ca69bf8..1d640c1 100644 (file)
@@ -2273,7 +2273,7 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd,
        return err;
 }
 #endif /* CONFIG_FINEGRAINED_THP */
-
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 static int remap_try_huge_pmd(struct mm_struct *mm, pmd_t *pmd, unsigned long addr,
                                unsigned long end, unsigned long pfn,
                                pgprot_t prot)
@@ -2305,6 +2305,7 @@ static int remap_try_huge_pmd(struct mm_struct *mm, pmd_t *pmd, unsigned long ad
 
        return ret;
 }
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
 static inline int remap_pmd_range(struct mm_struct *mm, pud_t *pud,
                        unsigned long addr, unsigned long end,
@@ -2322,10 +2323,11 @@ static inline int remap_pmd_range(struct mm_struct *mm, pud_t *pud,
        do {
                next = pmd_addr_end(addr, end);
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
                if (remap_try_huge_pmd(mm, pmd, addr, next,
                                       pfn + (addr >> PAGE_SHIFT), prot))
                        continue;
-
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
                err = remap_pte_range(mm, pmd, addr, next,
                                pfn + (addr >> PAGE_SHIFT), prot);
                if (err)