]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-huge_memoryc-add-missing-read-only-thp-checking-in-transparent_hugepage_enabled-v4
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 2 Jun 2021 03:52:45 +0000 (13:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Jun 2021 03:52:45 +0000 (13:52 +1000)
define transhuge_vma_enabled next to transhuge_vma_suitable

Link: https://lkml.kernel.org/r/20210514093007.4117906-1-linmiaohe@huawei.com
Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
include/linux/huge_mm.h

index a35c13d1f48738dd6815ecc4fcc46cf2db99b619..7b7f7b52ccb80aa52f474a52e8977921745301c7 100644 (file)
@@ -115,6 +115,21 @@ extern struct kobj_attribute shmem_enabled_attr;
 
 extern unsigned long transparent_hugepage_flags;
 
+static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
+               unsigned long haddr)
+{
+       /* Don't have to check pgoff for anonymous vma */
+       if (!vma_is_anonymous(vma)) {
+               if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
+                               HPAGE_PMD_NR))
+                       return false;
+       }
+
+       if (haddr < vma->vm_start || haddr + HPAGE_PMD_SIZE > vma->vm_end)
+               return false;
+       return true;
+}
+
 static inline bool transhuge_vma_enabled(struct vm_area_struct *vma,
                                          unsigned long vm_flags)
 {
@@ -159,21 +174,6 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
 
 bool transparent_hugepage_active(struct vm_area_struct *vma);
 
-static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
-               unsigned long haddr)
-{
-       /* Don't have to check pgoff for anonymous vma */
-       if (!vma_is_anonymous(vma)) {
-               if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
-                               HPAGE_PMD_NR))
-                       return false;
-       }
-
-       if (haddr < vma->vm_start || haddr + HPAGE_PMD_SIZE > vma->vm_end)
-               return false;
-       return true;
-}
-
 #define transparent_hugepage_use_zero_page()                           \
        (transparent_hugepage_flags &                                   \
         (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))