mm, thp: hide remap_try_huge_pmd for the THP-disabled kernel 65/264265/1 accepted/tizen/unified/20210916.005836 submit/tizen/20210915.075337 submit/tizen/20210915.095105
authorSung-hun Kim <sfoon.kim@samsung.com>
Wed, 15 Sep 2021 07:39:13 +0000 (16:39 +0900)
committerSung-hun Kim <sfoon.kim@samsung.com>
Wed, 15 Sep 2021 07:47:08 +0000 (16:47 +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: 8690fa3fc22a ('mm, meminfo: modify page counting')
Change-Id: Iae9efb2edf6cd563c794af68bea7987110a5b2da
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
mm/memory.c

index e6deee2..f1e5eb9 100644 (file)
@@ -2259,7 +2259,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)
@@ -2291,6 +2291,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,
@@ -2308,10 +2309,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)