1 #include <linux/shmem_fs.h>
2 #include <asm/huge_mm.h>
4 bool arm64_hugepage_vma_shmem_check(struct vm_area_struct *vma,
5 unsigned long vm_flags, int nr_pages)
7 /* Enabled via shmem mount options or sysfs settings. */
8 if (shmem_file(vma->vm_file) && shmem_huge_enabled(vma)) {
9 return IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
15 bool arm64_hugepage_vma_file_check(struct vm_area_struct *vma,
16 unsigned long vm_flags, int nr_pages)
18 /* Read-only file mappings need to be aligned for THP to work. */
19 if (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) && vma->vm_file &&
20 (vm_flags & VM_DENYWRITE) && !(vm_flags & VM_WRITE)) {
21 return IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,