From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-f176.google.com (mail-ie0-f176.google.com [209.85.223.176]) by kanga.kvack.org (Postfix) with ESMTP id 8B0CE6B0036 for ; Fri, 31 Jan 2014 13:24:07 -0500 (EST) Received: by mail-ie0-f176.google.com with SMTP id tp5so4644807ieb.21 for ; Fri, 31 Jan 2014 10:24:07 -0800 (PST) Received: from relay.sgi.com (relay3.sgi.com. [192.48.152.1]) by mx.google.com with ESMTP id nr4si16257862igc.51.2014.01.31.10.23.57 for ; Fri, 31 Jan 2014 10:23:57 -0800 (PST) From: Alex Thorlton Subject: [PATCH 1/3] Revert "thp: make MADV_HUGEPAGE check for mm->def_flags" Date: Fri, 31 Jan 2014 12:23:44 -0600 Message-Id: <1391192628-113858-4-git-send-email-athorlton@sgi.com> In-Reply-To: <1391192628-113858-1-git-send-email-athorlton@sgi.com> References: <1391192628-113858-1-git-send-email-athorlton@sgi.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org Cc: Alex Thorlton , Oleg Nesterov , Gerald Schaefer , Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Andrew Morton , Paolo Bonzini , "Kirill A. Shutemov" , Mel Gorman , Rik van Riel , Ingo Molnar , Peter Zijlstra , Sasha Levin , linux390@de.ibm.com, linux-s390@vger.kernel.org, linux-mm@kvack.org This reverts commit 8e72033f2a489b6c98c4e3c7cc281b1afd6cb85cm, and adds in code to fix up any issues caused by the revert. The revert is necessary because hugepage_madvise would return -EINVAL when VM_NOHUGEPAGE is set, which will break subsequent chunks of this patch set. Signed-off-by: Alex Thorlton Cc: Oleg Nesterov Cc: Gerald Schaefer Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Christian Borntraeger Cc: Andrew Morton Cc: Paolo Bonzini Cc: "Kirill A. Shutemov" Cc: Mel Gorman Cc: Rik van Riel Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Sasha Levin Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- arch/s390/mm/pgtable.c | 3 +++ mm/huge_memory.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 3584ed9..a87cdb4 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c @@ -504,6 +504,9 @@ static int gmap_connect_pgtable(unsigned long address, unsigned long segment, if (!pmd_present(*pmd) && __pte_alloc(mm, vma, pmd, vmaddr)) return -ENOMEM; + /* large pmds cannot yet be handled */ + if (pmd_large(*pmd)) + return -EFAULT; /* pmd now points to a valid segment table entry. */ rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT); if (!rmap) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 82166bf..a4310a5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1968,8 +1968,6 @@ out: int hugepage_madvise(struct vm_area_struct *vma, unsigned long *vm_flags, int advice) { - struct mm_struct *mm = vma->vm_mm; - switch (advice) { case MADV_HUGEPAGE: /* @@ -1977,8 +1975,6 @@ int hugepage_madvise(struct vm_area_struct *vma, */ if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP)) return -EINVAL; - if (mm->def_flags & VM_NOHUGEPAGE) - return -EINVAL; *vm_flags &= ~VM_NOHUGEPAGE; *vm_flags |= VM_HUGEPAGE; /* -- 1.7.12.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org