aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/mm/pgtable.c3
-rw-r--r--mm/huge_memory.c13
2 files changed, 12 insertions, 4 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 796c9320c709..5d8324cd866b 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -505,6 +505,9 @@ static int gmap_connect_pgtable(unsigned long address, unsigned long segment,
505 if (!pmd_present(*pmd) && 505 if (!pmd_present(*pmd) &&
506 __pte_alloc(mm, vma, pmd, vmaddr)) 506 __pte_alloc(mm, vma, pmd, vmaddr))
507 return -ENOMEM; 507 return -ENOMEM;
508 /* large pmds cannot yet be handled */
509 if (pmd_large(*pmd))
510 return -EFAULT;
508 /* pmd now points to a valid segment table entry. */ 511 /* pmd now points to a valid segment table entry. */
509 rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT); 512 rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT);
510 if (!rmap) 513 if (!rmap)
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 /*