aboutsummaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 6ac89e9f82ef..a2f4981418fc 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1891,17 +1891,22 @@ out:
1891int hugepage_madvise(struct vm_area_struct *vma, 1891int hugepage_madvise(struct vm_area_struct *vma,
1892 unsigned long *vm_flags, int advice) 1892 unsigned long *vm_flags, int advice)
1893{ 1893{
1894 struct mm_struct *mm = vma->vm_mm;
1895
1896 switch (advice) { 1894 switch (advice) {
1897 case MADV_HUGEPAGE: 1895 case MADV_HUGEPAGE:
1896#ifdef CONFIG_S390
1897 /*
1898 * qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
1899 * can't handle this properly after s390_enable_sie, so we simply
1900 * ignore the madvise to prevent qemu from causing a SIGSEGV.
1901 */
1902 if (mm_has_pgste(vma->vm_mm))
1903 return 0;
1904#endif
1898 /* 1905 /*
1899 * Be somewhat over-protective like KSM for now! 1906 * Be somewhat over-protective like KSM for now!
1900 */ 1907 */
1901 if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP)) 1908 if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP))
1902 return -EINVAL; 1909 return -EINVAL;
1903 if (mm->def_flags & VM_NOHUGEPAGE)
1904 return -EINVAL;
1905 *vm_flags &= ~VM_NOHUGEPAGE; 1910 *vm_flags &= ~VM_NOHUGEPAGE;
1906 *vm_flags |= VM_HUGEPAGE; 1911 *vm_flags |= VM_HUGEPAGE;
1907 /* 1912 /*